[ 
https://issues.apache.org/jira/browse/PDFBOX-1757?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812832#comment-13812832
 ] 

William Palmer commented on PDFBOX-1757:
----------------------------------------

With the latest 2.0.0-SNAPSHOT more files work, which is great, but the 
following errors occur (only giving a sample file for each error):

040669.pdf: Expected pattern 'obj but missed at character 'o' 
(producer:"Acrobat PDFWriter 4.0 for Windows", opens in Acrobat 10.1.0/Windows)
064034.pdf: Expected operator 'ID' actual='In' (producer:"Acrobat Distiller 
8.1.0 (Windows)", opens in Acrobat 10.1.0/Windows)
189478.pdf: Expected an integer type, actual='f' (producer:"Acrobat PDFWriter 
4.05 for Windows NT", opens in Acrobat 10.1.0/Windows)
219789.pdf: Error expected floating point number actual='1e' (producer:"Acrobat 
Distiller 4.0 for Windows", opens in Acrobat 10.1.0/Windows)
247224.pdf: Unknown dir object c='>' cInt=62 peek='>' peekInt=62 3012537 
(producer:"Acrobat Distiller 7.0.5 (Windows)", opens in Acrobat 10.1.0/Windows)
379049.pdf: Expected operator 'ID' actual='Im' (producer:"Acrobat Distiller 6.0 
(Windows)", opens in Acrobat 10.1.0/Windows)
392154.pdf: Expected a long type, actual='ref' (producer:"Acrobat PDFWriter 4.0 
for Windows NT", opens in Acrobat 10.1.0/Windows)
427669,pdf: Expected a long type, actual='f' (producer:"Acrobat Distiller 4.05 
for Macintosh", opens in Acrobat 10.1.0/Windows)
443752.pdf: Expected operator 'ID' actual='I)' (producer:"Acrobat Distiller 
3.02", opens in Acrobat 10.1.0/Windows)
492484.pdf: Expected an integer type, actual='n' (producer:"Acrobat PDFWriter 
4.0 for Windows", opens in Acrobat 10.1.0/Windows)
498264.pdf: Expected a long type, actual='' (file looks empty in Acrobat - no 
error given though.  producer: "Mac OS X 10.2.6 Quartz PDFContext")

When closing some of these files in Acrobat it asks if I want to save them - 
possibly as it has fixed them?  However, they open without displaying an error. 
 Do you know if they also look like WONTFIX errors in the PDFs from a PDFBox 
point of view?  

Thanks


> Errors parsing/extracting text from a PDF
> -----------------------------------------
>
>                 Key: PDFBOX-1757
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1757
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 1.8.2
>         Environment: Ubuntu Linux & Windows 7 (both JDK6)
>            Reporter: William Palmer
>            Assignee: Timo Boehme
>            Priority: Minor
>
> I am trying to extract text from PDFs.  Extracting text from the test file 
> http://digitalcorpora.org/corp/nps/files/govdocs1/020/020747.pdf causes 
> exceptions to be thrown.
> The first:
> Exception in thread "main" java.lang.RuntimeException: java.io.IOException: 
> Value is not an integer: 636121514401477526485946144
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser$1.tryNext(PDFStreamParser.java:187)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser$1.hasNext(PDFStreamParser.java:194)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:255)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:235)
>       at 
> org.apache.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:215)
>       at 
> org.apache.pdfbox.util.PDFTextStripper.processPage(PDFTextStripper.java:455)
>       at 
> org.apache.pdfbox.util.PDFTextStripper.processPages(PDFTextStripper.java:379)
>       at 
> org.apache.pdfbox.util.PDFTextStripper.writeText(PDFTextStripper.java:335)
> Caused by: java.io.IOException: Value is not an integer: 
> 636121514401477526485946144
>       at org.apache.pdfbox.cos.COSNumber.get(COSNumber.java:104)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser.parseNextToken(PDFStreamParser.java:351)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser.access$000(PDFStreamParser.java:46)
>       at 
> org.apache.pdfbox.pdfparser.PDFStreamParser$1.tryNext(PDFStreamParser.java:182)
> Code to cause above exception:
> PDFTextStripper ts = new PDFTextStripper();
> PrintWriter out = new PrintWriter(new FileWriter(new File ("020747.txt")));
> PDDocument doc = PDDocument.load(new File("020747.pdf").toURI().toURL(), 
> true);
> ts.setForceParsing(true);
> ts.writeText(doc, out);
> Using the following code causes a different exception until 
> org.apache.pdfbox.baseParser.pushBackSize is increased (only tested 1024768). 
>  After it is increased I get basically the same exception as above
> PrintWriter out = new PrintWriter(new FileWriter(new File("020747.txt")));
> PDFParser parser = new PDFParser(new FileInputStream(new File("020747.pdf")));
> parser.parse();
> PDFTextStripper ts = new PDFTextStripper();
> ts.setForceParsing(true);
> ts.writeText(parser.getPDDocument(), out);



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to