iTextSharp is a .NET port of iText written in C#. The original port was done by Gerald Henson. Gerald stopped working on iTextSharp in 2003 and a few years later, in June 2005, Paulo Soares took over the project on SourceForge and provided a new version of iTextSharp. Paulo keeps the releases of iTextSharp in sync with the iText releases (although the numbering is slightly different: iTextSharp 4.0.8 corresponds with iText 2.0.8; 4.1.0 corresponds with 2.1.0; and so on).
iTextSharp is a library that allows you to generate and manipulate PDF files on the fly. Read the iText project description for more information. Most of the examples written in Java also work with iTextSharp, but you'll have to make small adaptations:
- Change the
importstatements, - Change the JAVA getters and setters
- ...
In other words, you should be acquainted with Microsoft C# programming to know how and where to translate specific Java terminology into C# jargon if you want to use these classes. iText works with the Microsoft .Net Framework 1.1 and later. If you need the hyphenation functionality or if you use a specific type of Asian fonts, you'll need some extra DLLs that can be downloaded from SourceForge:
- itext-hyph-xml contains XML files with hyphenation rules for different languages;
- iTextAsian is needed when you need Chinese, Japanese or Korean fonts that are generally referred to as CJK fonts. Those fonts are never embedded; the font programs are provided by Adobe as fontpacks that can be installed with Adobe Reader.
- There's very little chance that you'll ever need the iTextAsianCmaps (read the book for more info).
Also note that all functionality involving PdfGraphics2D (an implementation of java.awt.Graphics2D) and Swing (for instance: iText RUPS) are not ported to iTextSharp.
You can download iTextSharp from SourceForge. There's plenty of information available about iText (Java), but if you have troubles adapting the examples, have a look at the following sites:
- There are some tutorials on the CodeProject site:
- There are some tutorials in other languages:
- introduction to iTextSharp
in French (written by Joël Marty).
- Seraphinux provides more info about PDF with C#, and started writing a tutorial for iTextSharp (in Spanish).
- Read Govert's Tools page and look for the link to "iTextSharp in Delphi" in the left column (under Extra's).
- Finally there are also plenty of blog posts with examples. You'll find some links on RubyPDF's blog. These are some titles of other blog posts:
If your iTextSharp project is hosted on a server that has a partially trusted zone, you could get a SecurityException "That assembly does not allow partially trusted callers." If you run a simple script, it will probably work on your computer, but you could get a security exception on the server. That's because the iTextSharp assembly is not marked with the AllowPartiallyTrustedCallers attribute. For more info, read this blog post titled "Allowing Partially Trusted Callers" As you have the source for iTextSharp, you can build it any way you like and solve this problem yourself.
