I am listing many small and simple examples to put the stress on basic functionalities. These code examples are categorized into multiple sections based on the work they do OR functionality they achieve. I have tried to put as many examples com itextpdf text pdf pdfreader jar I found useful to put here to help you all.
If you think I am missing some more usecases, feel free to suggest me in comments area, I will add their examples in future. You can choose from a variety of fonts to be used in the document. Isn’t it great feature, right? Let’s list down and get familiar with important classes which we are going to use in this application. If you need to generate a PDF document from scratch, you will use the Document class. First you must create a Document instance.
Then you must open it. After that you add content to the document. Finally you close the Document instance. In a paragraph you can set the paragraph alignment, indentation and spacing before and after the paragraph. This class represents a chapter in the PDF document.
It is created using a Paragraph as title and an int as chapter number. This class contains all specifications of a font, such as family of font, size, style, and color. Various fonts are declared as static constants in this class. This is a table that can be put at an absolute position but can also be added to the document as the class Table.
An Anchor can be a reference or a destination of a reference. A link like we have in HTML pages. Used to read a PDF document. A Hello World PDF document. An example to show how attributes can be added to pdf files. Example contain adding images from file system as well as URLs.