tags:

views:

656

answers:

1

I want to replace the font embedded in an existing PDF file programmatically (with iText).

iText itself does not seem to provide any data model for glyphs and fonts, but I believe it can let me retrieve and update the binary stream that contains the font.

It's OK even if I don't know which glyph is associated to which font - what I want to do is just to replace them. To be precise, I want to embold all glyphs in a PDF document.

Replacing fonts in rendering time is not an option because the output must be PDF with all information preserved as is.

Is there anyone who has done this before with iText or any other PDF libraries?

A: 

PDF files define a set of fonts (ie F0, F1, F2) and then define these separately so you could theoretically rewrite the entry for F0. You would have to ensure the 2 fonts have the same spacing (or you will have to rewrite the PDF as well), and probably hack the PDF manually.