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

Andreas Lehmkühler commented on PDFBOX-1822:
--------------------------------------------

I had a quick look at the attached pdf (unsigned.pdf) and IMO it's broken:
{code}
xref
0 20
0000000000 65535 f
0000000015 00000 n
0000000497 00000 n
0000004753 00000 n
0000004810 00000 n
0000004917 00000 n
0000000200 00000 n
0000004960 00000 n
0000005185 00000 n
0000005234 00000 n
0000005275 00000 n
0000005515 00000 n
0000005537 00000 n
0000005741 00000 n
0000005776 00000 n
0000006109 00000 n
0000006161 00000 n
0000006457 00000 n
0000006724 00000 n
0000007034 00000 n
trailer
<<
/DecodeParms <<
/Columns 4
/Predictor 12
>>
/Filter /FlateDecode
/ID [<AB596626871BC84DB58B26BE18E76D38> <D82E074D4A5E8D459F3DF40B2A002015>]
/Info 6 0 R
/Length 58
/Root 1 0 R
/Size 20
/Type /XRef
/W [1 2 1]
/Index [14 13]
>>
startxref
24851
%%EOF
{code}

The pdf obviously uses a xref table. The trailer contains values which are only 
expected if the pdf uses a xref stream, such as the /Type /Size /W, but the 
stream itself is missing. In the following the COSWriter tries to determine if 
a xref table or a xref stream should be written by calling 
COSDocument#isXRefStream. That method delivers "true" as the broken trailer 
dictionary contains a "/Type /XRef" entry. Maybe we should introduce a new 
internal boolean value within the trailer which is set when reading a xref 
stream, so that we can be sure that the pdf really uses a xref stream not not 
just has broken trailer dictionary which leads to false information.

I hope this makes sense ... ;-)

> Signature byte range is Invalid
> -------------------------------
>
>                 Key: PDFBOX-1822
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1822
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing, PDModel, PDModel.AcroForm, Signing
>    Affects Versions: 1.8.3, 1.8.4, 2.0.0
>            Reporter: vakhtang koroghlishvili
>         Attachments: araxis-merge - compare two document.jpg, 
> damaged-sig.jpg, unsigned-signed.pdf, unsigned.pdf
>
>
> On person send me a unsigned PDF document. He wanted to sign it. When I try 
> to sign it (using pad box), I have some problem.
> After signing adobe reader tells me "The signature byre range is invalid".  
> I will attach original and signed document.
> I think, it is PDF box parser error. another signature libraries sign 
> document very well. I'm searching the problem at the moment, in order to fix 
> it.



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

Reply via email to