The Font is used to specify the font style of the text. It is represented by com.itextpdf.text.Font class.
Steps:
1. Create Document instance. It represents the current document to which we are adding content.
2. Create OutputStream instance. It represents the generated pdf.
3. Create PDFWriter instance and pass Document and OutputStream instance to its constructor.
4. Open the Document by calling document.open().
5. Create font object and specify the style.
6. Add the content to the document by calling document.add() method using chunk, paragraph etc object with font object.
7. Close the document by calling document.close() method.
2. Create OutputStream instance. It represents the generated pdf.
3. Create PDFWriter instance and pass Document and OutputStream instance to its constructor.
4. Open the Document by calling document.open().
5. Create font object and specify the style.
6. Add the content to the document by calling document.add() method using chunk, paragraph etc object with font object.
7. Close the document by calling document.close() method.
Example:
PDFFontExample.java
No comments:
Post a Comment