pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From S├ębastien Pennec <sebastien.pen...@gmail.com>
Subject ReplaceString and embedded fonts
Date Thu, 18 Oct 2012 07:13:32 GMT

I am using PDFBox to implement a simple search&replace, by following and
adding some features to the "ReplaceString" example.

The problem I ran into, is that the fonts that are embedded in the document
have been embedded as subsets. So if I add a letter that is not in the
subset, a space appears instead of the actual letter.

Unfortunately, I have no influence on the PDF generation (which is why I
have to count on this search&replace feature), so I thought about replacing
the font embedded as a subset by the same font, fully embedded.

I first tried this line of code:

 PDTrueTypeFont.*loadTTF*(doc, *new*File("path/to/my/font.ttf"));

but this seems to have an effect only if I create a new element, that I
link the returned PDFont object to.

Is there a way to actually replace the embedded font that has an effect on
all the text elements? Could I find the "Tf" operator, and change its
reference to point to a newly embedded font?

Thanks for your help,


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message