Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature box is invalid when signing PDF #91

Open
ridgey-dev opened this issue Jan 15, 2025 · 3 comments
Open

Signature box is invalid when signing PDF #91

ridgey-dev opened this issue Jan 15, 2025 · 3 comments

Comments

@ridgey-dev
Copy link

ridgey-dev commented Jan 15, 2025

Input PDF:
input.pdf

Undesired result:
output.pdf

When signing the document twice (so user can see multiple signature boxes on different pages) the result is that the only the last created signature box is valid. The first one has message "Document has been altered or corrupted since it was signed.".

Note that the input.pdf contains unsigned signature boxes, and it has been made using phpunite.

Code:

$document = PDFDoc::from_string($content);
$document->sign_document($certfile);
$content = $document->to_pdf_file_s();

$document = PDFDoc::from_string($content);
$document->sign_document($certfile);
$content = $document->to_pdf_file_s();

file_put_contents('output.pdf', $content);
@ridgey-dev
Copy link
Author

Is there already some progress on this that could be shared?

@angeljqv
Copy link

angeljqv commented Feb 7, 2025

Feel free to make a PR with the fix

@ridgey-dev
Copy link
Author

I don't have a fix for it. I was kinda hoping a contributor could look into it to have some insights why it's working like this for this document.

The workaround for me right now is that I create a new PDF by loading the file into QPDF. Signing the output of that won't generate an error. This is of course not very helpful for a fix in this package, but maybe it could help finding the root problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants