创建.PDF文件【1】

准备:

下载两个控件: itextsharp.dll 和 ICSharpCode.SharpZipLib.dll

在项目引用中添加以上两个文件, 并在代码里添加下面代码即可

using iTextSharp.text;
using iTextSharp.text.pdf;

 

HelloWorld:

    static void Main(string[] args)
    {
      Document doc = new Document();
      PdfWriter.GetInstance(doc, new FileStream("Chap0101.pdf", FileMode.Create));
      doc.Open();
      doc.Add(new Paragraph("Hello World"));
      doc.Close();
      System.Console.ReadKey();
    }
posted @ 2012-03-17 22:10  wouldguan  阅读(139)  评论(0编辑  收藏  举报