iText 5 examples in practice

If you want to get to work on iText libraries, you have come to the right place. It's always a good idea to check back regularly for new examples or browse this section before calling in our support desk.

Categories

Building blocks

iText ships with a series of building blocks that allow you to create a document, e.g. Chunk, Phrase, Paragraph, List.


Tables

Many documents present content in the form of tables. PdfPTable is one of the most used objects in iText.


Page events

Page events provide automated code execution when a document is opened or closed, when a page starts or ends, or when a paragraph starts or ends.


Fonts

Having trouble with fonts? Maybe you're using the wrong font. Are you sure it knows how to draw the glyphs you need? Are you using the right encoding? Type1 fonts, TrueType fonts, OpenType fonts, Latin-1 or Unicode - here is where you'll find the examples you need.


Images

iText supports many types of images: Jpeg, Jpeg2000, Gif, PNG, WMF, JBIG2, CCITT, and so on. But there's more: you can clip images or make them transparent or black and white. You can also draw paths and shapes and fill them with color.


ColumnText

ColumnText is an object that can be used to add content at absolute positions.


Forms

There are two types of interactive form in PDF: forms based on AcroForm technology and forms based on XML Forms Architecture (XFA). Discover how to examine, fill out and flatten forms.


Actions and annotations

PDF has many interactive features. It supports JavaScript, internal and external links, and different types of annotations.


PDF/A and PDF/UA

PDF/A (ISO 19005) and PDF/UA (ISO 14289) are the ISO standards for archiving and universal accessibility.


Extraction and redaction

iText can parse the content of a PDF document and extract content from it. This content can also be redacted with iText.


Security

PDFs can be encrypted and digitally signed.


Graphics

Examples that involve creating and drawing lines and shapes, changing the graphics state, color, graphics2D,...


Miscellaneous

Examples on how to create bar codes, how to introduce logging, and much more.


ZUGFeRD

ZUGFeRD is a standard for electronic invoices based on the Cross Industry Invoice (CII) standard and PDF/A-3. Read all about it in ‘The Future of Invoicing' and try some of the examples.


iText in Action

This book’s second edition was published in 2010 and contains about 300 code samples.


Merging existing PDFs

PDFs can be copied, merged, assembled on a page by page basis.


Manipulating an existing PDF

With PdfStamper, you can add content such as watermarks, headers, footers to an existing document.


XML Worker

iText can convert straightforward XHTML and CSS to PDF with the XML Worker add-on.