com.itextpdf Code Samples
- How do I customize the Phrase object?
- How do I use iText Paragraph class?
- How do I create a List in iText?
- How do I create super / subscript in iText?
- How do I rotate cell contents in iText?
- How do I set the absolute position of an image in iText?
- How do I use iText Phrase class?
- How do I use iText Chunk class?
- How do I create roman or greek numeral list in iText?
- How do I create nested table in iText?
- How do I set table's cell alignmen in iText?
- How do I set table's cell padding in iText?
- How do I rotate image in iText pdf document?
- How do I scale an image in pdf document using iText?
How do I create a PDF document using iText?
This example is the first example of the iText series on how to use the iText library to create a PDF document.
In this example we show how to use the Document class, getting an instance of PdfWriter, etc. Creating a simple Paragraph and set the text alignment and the font. Let see the code below:
In the example above you've seen some basic steps that we use to produce a PDF documents. These steps are:
- Create a
Documentobject that represents a PDF document. - The
PdfWriteobject that need theDocumentand anOutputStreamobject write the content of the PDF we added to theDocumentinto a PDF file. - We add a paragraph into the
Documentinstance using theParagraphobject. - Finally we need to close the document by calling the
Document.close()method.