Load various font files in Apache PDFBox

Apache PDFbox is an open source java library used for manipulation of PDF’s. In this post we will see how to use the base fonts and load various font files in Apache PDFBox.

Use of Base Fonts in Apache PDFBox

PDFBox provides support for inbuilt font using the PDType1Font class. Few of the fonts supported by this class are
PDType1Font.TIMES_ROMAN
PDType1Font.TIMES_BOLD
PDType1Font.TIMES_ITALIC
PDType1Font.TIMES_BOLD_ITALIC
PDType1Font.HELVETICA
PDType1Font.HELVETICA_BOLD
PDType1Font.HELVETICA_OBLIQUE
PDType1Font.HELVETICA_BOLD_OBLIQUE
PDType1Font.COURIER Courier
PDType1Font.COURIER_BOLD
PDType1Font.COURIER_OBLIQUE
PDType1Font.COURIER_BOLD_OBLIQUE
PDType1Font.SYMBOL

Lets see an example on how to use these fonts. See the highlighted lines on how to use base fonts.

Load various font files in Apache PDFBox

Now lets see how to load various font files in Apache PDFBox

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn