PDFBox Working with Fonts
In PDFBox, there might be a need to add text with different font family and size. The PDFBox specification states that "The standard set of 14 fonts will always be available in working with PDF documents". In PDFBox, these set of 14 fonts are defined as constants in the PDType1Font class. A Font is loaded from a file by using PDType1Font API. PDFBox supports the following fonts-
We can configured font for text by using setFont API available on Content Stream.
This example creates a new document and prints the text "Hello World!!!" using one of the PDF base Font.
After successful execution of the above program, open the PDF Document which shows the following output.