I have a java application which splits a pdf into sections using itext, then stitches a selection of these up t开发者_开发知识库ogether again. The original pdf has many embedded fonts varying in type (all non-system fonts). When I stitch the pdf's up again, some of the embedded fonts are missing.
For example, this is a clipping from the original fonts list:
This is a clipping from the generated pdf font list:
I am using PdfWriter and PdfReader to copy the pages into the new document, with PdfContent and addTemplate().
Finally found the answer! The problem was the level of Pdf was set too low:
writer.setPdfVersion(PdfWriter.VERSION_1_2);
I changed this to:
writer.setPdfVersion(PdfWriter.VERSION_1_7);
and now all fonts are embedded correctly.
I actually forgot that piece of code was in there - I had borrowed it from a project I had done in the past.
Lesson learned ;)
I would love to know why this is the case though.
精彩评论