You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Kosta Krauth (JIRA)" <ji...@apache.org> on 2011/02/14 00:06:03 UTC
[jira] Updated: (PDFBOX-831) PDPage.convertToImage throwing an
uncaught IOException internally
[ https://issues.apache.org/jira/browse/PDFBOX-831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kosta Krauth updated PDFBOX-831:
--------------------------------
Affects Version/s: 1.5.0
> PDPage.convertToImage throwing an uncaught IOException internally
> -----------------------------------------------------------------
>
> Key: PDFBOX-831
> URL: https://issues.apache.org/jira/browse/PDFBOX-831
> Project: PDFBox
> Issue Type: Bug
> Components: PDModel
> Affects Versions: 1.2.1, 1.3.1, 1.5.0
> Environment: Windows 7, jdk1.6.0_21
> Reporter: Kosta Krauth
> Attachments: document.pdf
>
>
> After successfully loading a PDF document and extracting pages from it using the following snippet:
> doc = PDDocument.load(f);
> pages = doc.getDocumentCatalog().getAllPages();
> I try and convert the front page to an image as follows:
> PDPage page = (PDPage) pages.get(0);
> BufferedImage image = page.convertToImage();
> The page.convertToImage() causes a RuntimeException to be thrown due to an uncaught internal IOException. Otherwise, the extracting of text/images and all other functions I tried work correctly on this document.
> Here is the stack trace:
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: The handle is invalid
> at org.apache.pdfbox.pdfparser.PDFStreamParser$1.tryNext(PDFStreamParser.java:149)
> at org.apache.pdfbox.pdfparser.PDFStreamParser$1.hasNext(PDFStreamParser.java:158)
> at org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:241)
> at org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:208)
> at org.apache.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:112)
> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:722)
> at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:693)
> at pdfboxtestant.Main.getFrontPageImage(Main.java:44)
> at pdfboxtestant.Main.main(Main.java:25)
> Caused by: java.io.IOException: The handle is invalid
> at java.io.RandomAccessFile.seek(Native Method)
> at org.apache.pdfbox.io.RandomAccessFile.seek(RandomAccessFile.java:59)
> at org.apache.pdfbox.io.RandomAccessFileInputStream.read(RandomAccessFileInputStream.java:96)
> at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
> at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
> at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
> at java.io.FilterInputStream.read(FilterInputStream.java:66)
> at java.io.PushbackInputStream.read(PushbackInputStream.java:122)
> at org.apache.pdfbox.io.PushBackInputStream.read(PushBackInputStream.java:84)
> at org.apache.pdfbox.pdfparser.BaseParser.skipSpaces(BaseParser.java:1296)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.parseNextToken(PDFStreamParser.java:197)
> at org.apache.pdfbox.pdfparser.PDFStreamParser.access$000(PDFStreamParser.java:47)
> at org.apache.pdfbox.pdfparser.PDFStreamParser$1.tryNext(PDFStreamParser.java:146)
> ... 8 more
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira