why both pdfbox and pdfrenderer can not support "Additional fonts"?
I have a pdf which contains 'UniCNS-UCS2-H' font, I tried both pdfbox and pdfrenderer, they all throw exception: Unknown encoding for 'UniCNS-UCS2-H'
and this font was included in a font file :mingliu.ttc(it's a true type collection file, I don't know does this matter ?
what can I do to let these two libraries support addi开发者_运维知识库tional fonts ?
The encoding for a font in PDF documents is specified in the font dictionary object. The font you are encountering is encoded using 'UniCNS-UCS2-H', which as far as I can tell is a variant of Chinese encoding.
PDFBox only supports 4 encodings:
- PDFDocEncoding
- MacRomanEncoding
- StandardEncoding
- WinAnsiEncoding
These are defined in the font dictionary object inside the pdf stream
(e.g. .../Encoding/WinAnsiEncoding/...
)
When PDFBox encounters an unknown encoding, the exception you reported is shown.
For more information about fonts in PDF documents, see section 9.5 through 9.8 of the PDF Specification
精彩评论