You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Samuel Litster (Jira)" <ji...@apache.org> on 2020/02/11 19:26:00 UTC

[jira] [Created] (PDFBOX-4770) createDescendantFont throws 'Invalid font type: COSName{Font}' when reading pdf

Samuel Litster created PDFBOX-4770:
--------------------------------------

             Summary: createDescendantFont throws 'Invalid font type: COSName{Font}' when reading pdf
                 Key: PDFBOX-4770
                 URL: https://issues.apache.org/jira/browse/PDFBOX-4770
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel, Text extraction
    Affects Versions: 2.0.11
         Environment: Java 8, macOS Mojave 10.14.6
            Reporter: Samuel Litster


Our system needs to extract text from pdfs. It's been working for over a year, but today we started seeing errors when we tried to process some pdfs. This has only affected a small number of pdfs so far, but when it does come up we are unable to extract the text. Following is the pertinent part of the stacktrace:

Caused by: java.io.IOException: Invalid font type: COSName\{Font}Caused by: java.io.IOException: Invalid font type: COSName\{Font} at org.apache.pdfbox.pdmodel.font.PDFontFactory.createDescendantFont(PDFontFactory.java:129) at org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:192) at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:83) at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146) at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60) at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:848) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:503) at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:477) at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:150) at org.apache.pdfbox.text.LegacyPDFStreamEngine.processPage(LegacyPDFStreamEngine.java:139) at org.apache.pdfbox.text.PDFTextStripper.processPage(PDFTextStripper.java:391) at org.apache.pdfbox.text.PDFTextStripper.processPages(PDFTextStripper.java:319) at org.apache.pdfbox.text.PDFTextStripper.writeText(PDFTextStripper.java:266)

We have no control over the content of the pdfs, but we have to be able to extract the text from them. Is there a workaround for this or some way to configure PDFBox to handle this properly?

The offending pdfs are over 60 MB so I can't attach one to this issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org