You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Sean Bridges (JIRA)" <ji...@apache.org> on 2009/05/13 02:06:45 UTC

[jira] Created: (PDFBOX-469) q command not supported

q command not supported
-----------------------

                 Key: PDFBOX-469
                 URL: https://issues.apache.org/jira/browse/PDFBOX-469
             Project: PDFBox
          Issue Type: Bug
    Affects Versions: 0.8.0-incubator
            Reporter: Sean Bridges


This is with svn version 773978

I have several files which fail with sections like,

endobj
187 0 obj
<</ProcSet[/PDF/Text]
/Font<</F0 7 0 R
/F1 12 0 R
>>
/XObject<<>>
>>
endobj
q
3 0 obj
<</CreationDate (D:20050222175042)
/Producer (PDFlib 3.02 \(ActiveX/Win32\))
>>
endobj


They fail due to the "q" line.  I think this is a directive to save the current graphics state, as described in 4.3.1 of the PDF Reference, V 1.7

The exception stack trace is,

Caused by: java.io.IOException: Error: Expected an integer type, actual='q'
	at org.apache.pdfbox.pdfparser.BaseParser.readInt(BaseParser.java:1197)
	at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:459)
	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:169)
	at message_analyzer.extractor.PDFExtractor.getContent(PDFExtractor.java:32)

Adding the code,

        else if(peekedChar == 'q' || peekedChar == 'Q') {
            pdfSource.read();
            skipSpaces();         
        }

around line 434 in the parseObject() method of PDFParser seems to fix it.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-469) q command not supported

Posted by "Daniel Wilson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708711#action_12708711 ] 

Daniel Wilson commented on PDFBOX-469:
--------------------------------------

Sean,

The "q" operator is supported by the class org.apache.pdfbox.util.operator.GSave

See \trunk\src\main\resources\Resources\PageDrawer.properties for the list of operators and classes that support them.  (Also for the operators not yet supported.)

A parse error indicates something other than lack of operator support.  I think it indicates the PDF file has something out of the sequence in which PDFBox expects it.

> q command not supported
> -----------------------
>
>                 Key: PDFBOX-469
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-469
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 0.8.0-incubator
>            Reporter: Sean Bridges
>
> This is with svn version 773978
> I have several files which fail with sections like,
> endobj
> 187 0 obj
> <</ProcSet[/PDF/Text]
> /Font<</F0 7 0 R
> /F1 12 0 R
> >>
> /XObject<<>>
> >>
> endobj
> q
> 3 0 obj
> <</CreationDate (D:20050222175042)
> /Producer (PDFlib 3.02 \(ActiveX/Win32\))
> >>
> endobj
> They fail due to the "q" line.  I think this is a directive to save the current graphics state, as described in 4.3.1 of the PDF Reference, V 1.7
> The exception stack trace is,
> Caused by: java.io.IOException: Error: Expected an integer type, actual='q'
> 	at org.apache.pdfbox.pdfparser.BaseParser.readInt(BaseParser.java:1197)
> 	at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:459)
> 	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:169)
> 	at message_analyzer.extractor.PDFExtractor.getContent(PDFExtractor.java:32)
> Adding the code,
>         else if(peekedChar == 'q' || peekedChar == 'Q') {
>             pdfSource.read();
>             skipSpaces();         
>         }
> around line 434 in the parseObject() method of PDFParser seems to fix it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-469) q command not supported

Posted by "Sean Bridges (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12708747#action_12708747 ] 

Sean Bridges commented on PDFBOX-469:
-------------------------------------

Do you need more info to see if the pdf file is invalid?  I can't give you the file, but I can give you snippets of it as above.

Even if the file is invalid, it may be good to skip the "q" command to be more robust in the face of invalid pdf's.

> q command not supported
> -----------------------
>
>                 Key: PDFBOX-469
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-469
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 0.8.0-incubator
>            Reporter: Sean Bridges
>
> This is with svn version 773978
> I have several files which fail with sections like,
> endobj
> 187 0 obj
> <</ProcSet[/PDF/Text]
> /Font<</F0 7 0 R
> /F1 12 0 R
> >>
> /XObject<<>>
> >>
> endobj
> q
> 3 0 obj
> <</CreationDate (D:20050222175042)
> /Producer (PDFlib 3.02 \(ActiveX/Win32\))
> >>
> endobj
> They fail due to the "q" line.  I think this is a directive to save the current graphics state, as described in 4.3.1 of the PDF Reference, V 1.7
> The exception stack trace is,
> Caused by: java.io.IOException: Error: Expected an integer type, actual='q'
> 	at org.apache.pdfbox.pdfparser.BaseParser.readInt(BaseParser.java:1197)
> 	at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:459)
> 	at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:169)
> 	at message_analyzer.extractor.PDFExtractor.getContent(PDFExtractor.java:32)
> Adding the code,
>         else if(peekedChar == 'q' || peekedChar == 'Q') {
>             pdfSource.read();
>             skipSpaces();         
>         }
> around line 434 in the parseObject() method of PDFParser seems to fix it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.