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

John Hewson resolved PDFBOX-1748.
---------------------------------

    Resolution: Not A Problem

Closing, as this does not appear to have been an issue with PDFBox. If there's 
a future reason to think otherwise, feel free to re-open this issue.

> PDPage.convertToImage fails with IndexOutOfBoundsException: Index: 0, Size: 0
> -----------------------------------------------------------------------------
>
>                 Key: PDFBOX-1748
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1748
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.7.1, 1.8.2
>            Reporter: Kurt M
>         Attachments: PDFTest.java
>
>
> I am trying to create jpg images from pages in a pdf document.  The following 
> code works in most environments, but we recently installed on a new system 
> and are experiencing a high rate of failure there.  The same files that fail 
> there work in other environments.
> Here is my code:
>         PDDocument doc;
>         try {           
>             RandomAccess scratchFile = new RandomAccessBuffer();           
>             doc = PDDocument.loadNonSeq( pdfFile, scratchFile );         
>             int pageNum = 0;
>             int fullRes = 96;
>             List<PDPage> pages = doc.getDocumentCatalog().getAllPages();
>             BufferedImage fullImg;
>             for( PDPage page : pages ) {
>                 pageNum++;
>                 fullImg = page.convertToImage( BufferedImage.TYPE_INT_RGB, 
> fullRes );
> and here is the stack trace (this is from the 1.7.1 version I think):
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>       at java.util.ArrayList.get(ArrayList.java:352)
>       at 
> org.apache.pdfbox.io.RandomAccessBuffer.seek(RandomAccessBuffer.java:84)
>       at 
> org.apache.pdfbox.io.RandomAccessFileInputStream.read(RandomAccessFileInputStream.java:96)
>       at java.io.BufferedInputStream.read1(BufferedInputStream.java:267)
>       at java.io.BufferedInputStream.read(BufferedInputStream.java:328)
>       at java.io.BufferedInputStream.fill(BufferedInputStream.java:229)
>       at java.io.BufferedInputStream.read(BufferedInputStream.java:248)
>       at java.io.FilterInputStream.read(FilterInputStream.java:77)
>       at java.io.PushbackInputStream.read(PushbackInputStream.java:133)
>       at 
> org.apache.pdfbox.io.PushBackInputStream.read(PushBackInputStream.java:91)
>       at 
> org.apache.pdfbox.pdfparser.BaseParser.skipSpaces(BaseParser.java:1547)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser.parseNextToken(PDFStreamParser.java:230)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser.access$000(PDFStreamParser.java:46)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser$1.tryNext(PDFStreamParser.java:182)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser$1.hasNext(PDFStreamParser.java:194)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:257)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:237)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:217)
>       at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:119)
>       at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:730)
>       at generateSlideImages(PDFUtils.java:213) <-- my code



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to