pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PDFBOX-4559) Parse error reading embedded Type1 font
Date Wed, 05 Jun 2019 16:29:00 GMT

     [ https://issues.apache.org/jira/browse/PDFBOX-4559?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jack updated PDFBOX-4559:
-------------------------
    Description: 
I got following error while running a simple parallel rendering code. However, the error
doesn't happen when I change parallelStream to sequential (stream()). Interestingly, both
methods will render exact same images. I saw a possible related ticket PDFBOX-3654. But seems
that issue was fixed. I'd like to learn if we have some more bugs related?  

*Sample code*:
{code:java}
PDDocument document = PDDocument.load(new File(pdfFilename));
List<PDDocument> pdfPages = new Splitter().split(document);
pdfPages.parallelStream().forEach(page -> {
 try {

PDFRenderer renderer = new PDFRenderer(page);
renderer.renderImageWithDPI(0, 180, ImageType.RGB); // change dpi to your number
} catch (IOException e) {
 System.out.println(e);
}

try {
 pdfPage.close();
} catch (IOException ignored) {
}
});

try {
 document.close();
} catch (IOException ignored) {
}
{code}
 

*Error log*:
{noformat}
ERROR [PDType1Font] Can't read the embedded Type1 font POAEND+Gotham-Book
java.io.IOException: unexpected closing parenthesis
 at org.apache.fontbox.type1.Type1Lexer.readToken(Type1Lexer.java:123) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Lexer.nextToken(Type1Lexer.java:75) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.readValue(Type1Parser.java:398) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.readOtherSubrs(Type1Parser.java:707) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.parseBinary(Type1Parser.java:550) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.parse(Type1Parser.java:64) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Font.createWithSegments(Type1Font.java:85) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:262) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:62) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:265) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:314) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]

WARN [PDType1Font] Using fallback font Helvetica for POAEND+Gotham-Book
{noformat}

  was:
I got following error while running a simple parallel rendering code. However, the error
doesn't happen when I change parallelStream to sequential (stream()). Interestingly, both
methods will render exact same images. I saw a possible related ticket [PDFBOX-3654|https://issues.apache.org/jira/browse/PDFBOX-3654].
But seems that issue was fixed. I'd like to learn if we have some more bugs related?  

*Sample code*:
{code}
PDDocument document = PDDocument.load(new File(pdfFilename));
List<PDDocument> pdfPages = new Splitter().split(document);
pdfPages.parallelStream().forEach(page -> {
 try {

PDFRenderer renderer = new PDFRenderer(page);
renderer.renderImageWithDPI(0, 180, ImageType.RGB); // change dpi to your number
} catch (IOException e) {
 System.out.println(e);
}

try {
 pdfPage.close();
} catch (IOException ignored) {
}
});

try {
 document.close();
} catch (IOException ignored) {
}
{code}
 

*Error log*:
{noformat}
ERROR [PDType1Font] Can't read the embedded Type1 font POAEND+Gotham-Book
java.io.IOException: unexpected closing parenthesis
 at org.apache.fontbox.type1.Type1Lexer.readToken(Type1Lexer.java:123) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Lexer.nextToken(Type1Lexer.java:75) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.readValue(Type1Parser.java:398) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.readOtherSubrs(Type1Parser.java:707) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.parseBinary(Type1Parser.java:550) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Parser.parse(Type1Parser.java:64) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.fontbox.type1.Type1Font.createWithSegments(Type1Font.java:85) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:262) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:62) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:265) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:314) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
 at com.linkedin.vector.runner.processor.document.pdfconverter.test.processPDF(test.java:69)
~[runner/:?]
 at com.linkedin.vector.runner.processor.document.pdfconverter.test.lambda$doWork$0(test.java:52)
~[runner/:?]

WARN [PDType1Font] Using fallback font Helvetica for POAEND+Gotham-Book
{noformat}


> Parse error reading embedded Type1 font
> ---------------------------------------
>
>                 Key: PDFBOX-4559
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4559
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.15
>         Environment: Oracle Java 8 update125 on both Mac OS X and centos
>            Reporter: Jack
>            Priority: Major
>              Labels: type1, type1font
>         Attachments: 1ad65a37-3b3a-4e26-a40c-f2d90026a5bd.png, test.pdf
>
>
> I got following error while running a simple parallel rendering code. However, the
error doesn't happen when I change parallelStream to sequential (stream()). Interestingly,
both methods will render exact same images. I saw a possible related ticket PDFBOX-3654.
But seems that issue was fixed. I'd like to learn if we have some more bugs related?  
> *Sample code*:
> {code:java}
> PDDocument document = PDDocument.load(new File(pdfFilename));
> List<PDDocument> pdfPages = new Splitter().split(document);
> pdfPages.parallelStream().forEach(page -> {
>  try {
> PDFRenderer renderer = new PDFRenderer(page);
> renderer.renderImageWithDPI(0, 180, ImageType.RGB); // change dpi to your number
> } catch (IOException e) {
>  System.out.println(e);
> }
> try {
>  pdfPage.close();
> } catch (IOException ignored) {
> }
> });
> try {
>  document.close();
> } catch (IOException ignored) {
> }
> {code}
>  
> *Error log*:
> {noformat}
> ERROR [PDType1Font] Can't read the embedded Type1 font POAEND+Gotham-Book
> java.io.IOException: unexpected closing parenthesis
>  at org.apache.fontbox.type1.Type1Lexer.readToken(Type1Lexer.java:123) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Lexer.nextToken(Type1Lexer.java:75) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Parser.readValue(Type1Parser.java:398) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Parser.readOtherSubrs(Type1Parser.java:707) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Parser.parseBinary(Type1Parser.java:550) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Parser.parse(Type1Parser.java:64) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.fontbox.type1.Type1Font.createWithSegments(Type1Font.java:85) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:262) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:62) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:146) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:869)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:505)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:479)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:152)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:265) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:314) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:243) ~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
>  at org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:229)
~[pdfbox-2.0.15-snapshot108.jar:2.0.15-SNAPSHOT]
> WARN [PDType1Font] Using fallback font Helvetica for POAEND+Gotham-Book
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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


Mime
View raw message