[
https://issues.apache.org/jira/browse/PDFBOX-3426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15384560#comment-15384560
]
John Hewson commented on PDFBOX-3426:
-------------------------------------
The ArrayIndexOutOfBoundsException is occurring on the following line:
{code}
// fallback to the first cmap (may not be Unicode, so may produce poor results)
cmap = cmapTable.getCmaps()[0];
{code}
Which would suggest that something is wrong with the "cmap" table in the font
file. Presumably the table is present, but doesn't contain any actual cmaps. So
getCmaps() is an empty array.
As you can't share the PDF, please build PDFBox from source and make the
following change to TrueTypeFont.java, in getUnicodeCmap. Change this code:
{code}
if (isStrict)
{
throw new IOException("The TrueType font does not contain a Unicode cmap");
}
else {
...
{code}
To this:
{code}
if (isStrict)
{
throw new IOException("The TrueType font does not contain a Unicode cmap");
}
else if (cmapTable.getCmaps().length == 0)
{
throw new IOException("The TrueType font does not contain any cmaps");
}
else {
...
{code}
And let me know what happens. Does the file render as expected?
> ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 0
> ---------------------------------------------------------------
>
> Key: PDFBOX-3426
> URL: https://issues.apache.org/jira/browse/PDFBOX-3426
> Project: PDFBox
> Issue Type: Bug
> Components: Parsing
> Affects Versions: 2.0.2
> Environment: Win7, jdk1.8.0_60 x64
> Reporter: Luis Filipe Nassif
>
> The following stacktrace is shown with ExtractText and PDFReader when opening
> a file previously parsed by 1.8.10. Unfortunately the file can not be shared.
> {code}
> java.lang.RuntimeException: java.util.concurrent.ExecutionException:
> java.lang.ArrayIndexOutOfBoundsException: 0
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:176)
> sun.swing.AccumulativeRunnable.run(Unknown Source)
> java.security.AccessController.doPrivileged(Native Method)
>
> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
> Source)
> Caused by: java.util.concurrent.ExecutionException:
> java.lang.ArrayIndexOutOfBoundsException: 0
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:165)
> sun.swing.AccumulativeRunnable.run(Unknown Source)
> java.security.AccessController.doPrivileged(Native Method)
>
> java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
> Source)
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
> org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmap(TrueTypeFont.java:566)
>
> org.apache.pdfbox.pdmodel.font.PDCIDFontType2.<init>(PDCIDFontType2.java:183)
>
> org.apache.pdfbox.pdmodel.font.PDCIDFontType2.<init>(PDCIDFontType2.java:70)
>
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createDescendantFont(PDFontFactory.java:125)
> org.apache.pdfbox.pdmodel.font.PDType0Font.<init>(PDType0Font.java:128)
>
> org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:83)
> org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123)
>
> org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60)
>
> org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:815)
>
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:472)
>
> org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:446)
>
> org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149)
> org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:189)
> org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208)
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139)
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:68)
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:156)
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:139)
> java.lang.Thread.run(Unknown Source)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]