Generate PDF from HTML using itextsharp.dll

Category: 
Tags: iTextSharpDLLXML WorkeriText 5

I want to generate PDF from an ASPX page using a css file. How can I do this using iTextSharp? I've downloaded itextsharp-all-5.5.7, but which of all the DLLs must I include in my asp.net c# project?

Posted on StackOverflow on Nov 20, 2015 by Cristian Capannini

These are the DLLs you need to include in your project:

  1. iTextSharp DLL: (Required) I am assuming that you downloaded itextsharp-all-5.5.7.zip You need the itextsharp.dll that is stored in itextsharp-dll-core.zip

  2. PDF/A, PDF/UA, ZUGFeRD DLL: (Optional) If you want to produce PDF/A or PDF/UA or ZUGFeRD PDFs rather than plain old PDFs, then you also need itextsharp.pdfa.dll from itextsharp-dll-pdfa.zip. I would highly recommend making your PDFs at least accessible for the blind and the visually impaired. Most developer just don't care about PDF/UA and that's problematic.

  3. XML Worker: (Required) Since you want to convert HTML to PDF, you also need to download XML Worker: itextsharp.xmlworker-all-5.5.7.zip. In this zip, you'll find itextsharp-dll-xmlworker.zip. You need itextsharp.xmlworker.dll because that's where you'll find all the XML Worker classes.