com.itextpdf Code Samples
- How do I create a PDF document using iText?
- How do I create a table in PDF document?
- How do I create internal anchor in iText?
- How do I create Chapter in iText?
- How do I create anchor or link in iText?
- How do I set line space in Paragraph?
- How do I set paragraph indentation in iText?
- How do I set paragraph alignment in iText?
- How do I use iText Paragraph class?
- How do I use iText Document class?
- How do I customize the Phrase object?
- How do I create roman or greek numeral list in iText?
- How do I use iText Phrase class?
- How do I use iText Chunk class?
Page 1 of 3 |
Prev
|
Next
How do I use iText Document class?
The com.itextpdf.text.Document is the core class of the iText library. This class represents a pdf document. Basically to work with a document we must first create an instance of a Document. After the instance created we open the document by calling the open() method. To add some content into the document we can use the add() method. Finally after done with the document we must close it by calling the close() method.
If you need to write and flush the document into a file we can use a PdfWriter class. The class constructor accept a Document object and an OutputStream object to do the work.