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

Tilman Hausherr commented on PDFBOX-4312:
-----------------------------------------

This is being done in {{COSStandardOutputStream.setPos()}}. This works only if 
the output stream passed is a FileOutputStream. The best would be that you look 
into it with a debugger, if possible.

Sadly you didn't attach the new code so I can't check if you did use the code 
from September 19th.

Lets assume you did.

Then maybe {{COSStandardOutputStream.setPos()}} isn't accessed (that was the 
original bug), or it does nothing.

To test whether setting the position in a FileOutputStream works in .net, try a 
code like this in .net:
{code}
        FileOutputStream fos = new FileOutputStream("deleteme.txt");
        byte buf[] = new byte[25000];
        fos.write(buf);
        FileChannel fileChannel = fos.getChannel();
        fileChannel.position(5000);
        fos.write("Hello world".getBytes());
        fos.close();
        FileInputStream fis = new FileInputStream("deleteme.txt");
        int by;
        int pos = 0;
        while ((by = fis.read()) != -1)
        {
            if (by == 'H')
            {
                System.out.println("pos = " + pos);
                break;
            }
            ++pos;
        }
        fis.close();
{code}
The output should be "pos = 5000". If not, then positioning doesn't work on 
.net. In that case you should us PDFBox 2.0.12, which uses a different strategy.


> Signature is not getting inserted into 00000 area
> -------------------------------------------------
>
>                 Key: PDFBOX-4312
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4312
>             Project: PDFBox
>          Issue Type: Bug
>          Components: .NET, PDModel, Signing
>    Affects Versions: 1.8.9, 1.8.15
>            Reporter: bal
>            Priority: Major
>             Fix For: 1.8.17
>
>         Attachments: Screenshot (30).png, Screenshot (31).png, Screenshot 
> (31).png, testingSignature-signed-SaveIncremental-1param-bad-cutoff.pdf, 
> testingSignature-signed-SaveIncremental-2param-good.pdf, 
> testingSignature.pdf, testingSignature.pdf
>
>
> Hi ,
> I want to sign pdf using signature in pkcs 7 format . I am converting pkcs 7 
> signature to byte array using Convert.FromBase64String method in .net . I am 
> passing this byte array to sign method in signature interface which gets 
> called after calling saveincremental. My byte array is inserting proper but 
> the name of which signature is not shown when i open pdf. May be my byte 
> conversion may not proper or something else i am doing wrong. please let me 
> know.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to