Description
I get this exception with page.convertToImage():
Apr 27, 2012 10:58:46 AM org.apache.pdfbox.util.PDFStreamEngine processOperator
Warnung: java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-2)
java.lang.IllegalArgumentException: fromIndex(0) > toIndex(-2)
at java.util.ArrayList.subListRangeCheck(ArrayList.java:924)
at java.util.ArrayList$SubList.subList(ArrayList.java:1109)
at org.apache.fontbox.cff.CharStringConverter.handleType2Command(CharStringConverter.java:259)
at org.apache.fontbox.cff.CharStringConverter.handleCommand(CharStringConverter.java:81)
at org.apache.fontbox.cff.CharStringHandler.handleSequence(CharStringHandler.java:53)
at org.apache.fontbox.cff.CharStringConverter.convert(CharStringConverter.java:64)
at org.apache.fontbox.cff.CFFFont$Mapping.toType1Sequence(CFFFont.java:374)
at org.apache.fontbox.cff.Type1FontFormatter.printEexecFontDictionary(Type1FontFormatter.java:177)
at org.apache.fontbox.cff.Type1FontFormatter.printFontDictionary(Type1FontFormatter.java:127)
at org.apache.fontbox.cff.Type1FontFormatter.printFont(Type1FontFormatter.java:57)
at org.apache.fontbox.cff.Type1FontFormatter.format(Type1FontFormatter.java:47)
at org.apache.pdfbox.pdmodel.font.PDType1CFont.prepareAwtFont(PDType1CFont.java:546)
at org.apache.pdfbox.pdmodel.font.PDType1CFont.getawtFont(PDType1CFont.java:287)
at org.apache.pdfbox.pdmodel.font.PDType1Font.getawtFont(PDType1Font.java:216)
at org.apache.pdfbox.pdmodel.font.PDSimpleFont.drawString(PDSimpleFont.java:101)
at org.apache.pdfbox.pdfviewer.PageDrawer.processTextPosition(PageDrawer.java:194)
at org.apache.pdfbox.util.PDFStreamEngine.processEncodedText(PDFStreamEngine.java:494)
at org.apache.pdfbox.util.operator.ShowText.process(ShowText.java:45)
at org.apache.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:551)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:274)
at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:251)
at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:225)
at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:107)
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:722)
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:693)
at pdfboxpageimageextraction.ExtractImages.doPdf(ExtractImages.java:78)
at pdfboxpageimageextraction.ExtractImages.main(ExtractImages.java:52)
the code:
...
document = PDDocument.load(pdfFilename);
List pages = document.getDocumentCatalog().getAllPages();
int p = 0;
for (Object pobj : pages)
{
PDPage page = (PDPage) pobj;
++p;
BufferedImage bim = page.convertToImage();
....
This happens on page 25, (and others) on the attached PDF. (Note that when viewing that file with Acrobat Reader, the page number is "xxiv"). It seems to deal with special characters. In the attached PNG file, at least one such character is missing.
Attachments
Attachments
Issue Links
- depends upon
-
PDFBOX-1473 Incorrect handling of OpenType fonts
- Closed