Vb.net应用程序中的PDF生成器 [英] PDF Generator From Vb.net Application

查看:65
本文介绍了Vb.net应用程序中的PDF生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用Excel生成表单的Vb.net应用程序,我还需要生成PDF格式吗?

I have Vb.net application that generates a form using Excel i also need to generate in PDF how can i do this?

推荐答案

首先,您需要从以下位置下载"iTextSharp":iTextSharp

之后,提取iTextSharp,然后需要添加对文件itextsharp.dll的引用.选择右键单击项目->添加引用->浏览并浏览到提取的文件夹.

现在,您需要使用以下代码在c:\驱动器上创建pdf文件:

First of all you need to download "iTextSharp" from: iTextSharp

After that,extract iTextSharp and you need to add reference to file itextsharp.dll Chose right click on project-->add reference-->browse and browse to the extracted folder.

Now,you need to create pdf file on c:\ drive using this code:

Using fs As New IO.FileStream("c:\file.pdf", IO.FileMode.Create)
Using doc As New Document
Dim pdfWriter As pdf.PdfWriter = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, fs)             
doc.Open()
doc.Add(New Paragraph("Now pdf file is created and you can input what you need!"))
doc.Close()
End Using
End Using


一些链接可以为您提供帮助解决方案1中建议使用iText的方法:
http://en.wikipedia.org/wiki/IText [ http://itextpdf.com/ [ http://sourceforge.net/projects/itextsharp/ [
Some links to help you with iText suggested in Solution 1:
http://en.wikipedia.org/wiki/IText[^],
http://itextpdf.com/[^] (even though this is Java, most documentation is here),
http://sourceforge.net/projects/itextsharp/[^] (and this is .NET port of it, iTestSharp; this is what you would use).

—SA


这篇关于Vb.net应用程序中的PDF生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆