I am using the org.apache.pdfbox.multipdf.Overlay class to add a watermark to an existing PDF file. The watermark contains the name of the customer and therefore can contain a wide range of characters. To accommodate that I am embedding the NotoSansCJKtc-Regular.ttf font in the overlay document. (If I write the overlay document to a file the font is embedded as expected). However, when I use Overlay.overlayDocuments(Map<Integer,PDDocument>) the resulting file does not embed the font.
How the resulting PDF file is displayed depends on the PDF viewer and on whether the font happens to be installed on the system. Sometimes helpful warnings are produced (Acrobat if the font is not installed), sometimes the overlay text is displayed with what appears to random characters and random font (Google Chrome) and sometimes everything is shown beautifully. Can anyone direct me to how I can get the true type font embedded in the PDDocument created by overlayDocuments? What part am I missing? I will gladly provide some sample code / documents if there is obvious answer. Thanks, - Rainer