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

Unable to sign document after editing PDF #3949

Open
moritz76 opened this issue Nov 15, 2024 · 3 comments
Open

Unable to sign document after editing PDF #3949

moritz76 opened this issue Nov 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@moritz76
Copy link

moritz76 commented Nov 15, 2024

Is your feature request related to a problem? Please describe.
After editing a PDF in the browser to highlight something or insert an image, LibreSign throws an error when I try to sign the document: "Internal error. Please contact an administrator."

In the Nextcloud log, I find a lot of entries related to this action:

[libresign] Fehler: [{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Handler\/JSignPdfHandler.php","line":105,"function":"signWrapper","class":"OCA\\Libresign\\Handler\\JSignPdfHandler","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Handler\/JSignPdfHandler.php","line":76,"function":"signUsingVisibleElements","class":"OCA\\Libresign\\Handler\\JSignPdfHandler","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Handler\/Pkcs12Handler.php","line":133,"function":"sign","class":"OCA\\Libresign\\Handler\\JSignPdfHandler","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Service\/SignFileService.php","line":275,"function":"sign","class":"OCA\\Libresign\\Handler\\Pkcs12Handler","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Controller\/SignFileController.php","line":129,"function":"sign","class":"OCA\\Libresign\\Service\\SignFileService","type":"->"},{"file":"\/var\/www\/nextcloud\/apps\/libresign\/lib\/Controller\/SignFileController.php","line":95,"function":"sign","class":"OCA\\Libresign\\Controller\\SignFileController","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":208,"function":"signUsingUuid","class":"OCA\\Libresign\\Controller\\SignFileController","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/AppFramework\/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"\/var\/www\/nextcloud\/lib\/private\/Route\/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"\/var\/www\/nextcloud\/ocs\/v1.php","line":43,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"\/var\/www\/nextcloud\/ocs\/v2.php","line":7,"args":["\/var\/www\/nextcloud\/ocs\/v1.php"],"function":"require_once"}] POST /ocs/v2.php/apps/libresign/api/v1/sign/uuid/9e99a3a6-c111-4090-8b80-7dd41c630c5f von 2003:c1:9f04:6500:f329:f61d:e252:e99f von -- um 15.11.2024, 12:21:36 [libresign] Fehler: Error to sign PDF. ["FINE Default property file doesn't exists.","FINE Default property file doesn't exists.","INFO Checking input and output PDF paths.","INFO Getting key alias","INFO Used key alias: moritz busch","INFO Loading private key","INFO Getting certificate chain","INFO Opening input PDF file: \/tmp\/7b089a15366fcdc896a299330fbaf815.pdf","INFO Creating output PDF file: \/tmp\/7b089a15366fcdc896a299330fbaf815_signed.pdf","INFO Creating signature","SEVERE Problem occured","com.lowagie.text.DocumentException: Append mode requires a document without errors even if recovery was possible.","\tat com.lowagie.text.pdf.PdfStamperImp.(PdfStamperImp.java:123)","\tat com.lowagie.text.pdf.PdfStamper.(PdfStamper.java:130)","\tat com.lowagie.text.pdf.PdfStamper.createSignature(PdfStamper.java:707)","\tat net.sf.jsignpdf.SignerLogic.signFile(SignerLogic.java:204)","\tat net.sf.jsignpdf.Signer.signFiles(Signer.java:246)","\tat net.sf.jsignpdf.Signer.main(Signer.java:139)","","INFO Finished: Creating of signature failed."] POST /ocs/v2.php/apps/libresign/api/v1/sign/uuid/9e99a3a6-c111-4090-8b80-7dd41c630c5f von 2003:c1:9f04:6500:f329:f61d:e252:e99f von -- um 15.11.2024, 12:21:36

[libresign] Fehler: Error at JSignPdf side. LibreSign can not do nothing. Follow the error message: Error to sign PDF. ["FINE Default property file doesn't exists.","FINE Default property file doesn't exists.","INFO Checking input and output PDF paths.","INFO Getting key alias","INFO Used key alias: moritz busch","INFO Loading private key","INFO Getting certificate chain","INFO Opening input PDF file: /tmp/7b089a15366fcdc896a299330fbaf815.pdf","INFO Creating output PDF file: /tmp/7b089a15366fcdc896a299330fbaf815_signed.pdf","INFO Creating signature","SEVERE Problem occured","com.lowagie.text.DocumentException: Append mode requires a document without errors even if recovery was possible.","\tat com.lowagie.text.pdf.PdfStamperImp.(PdfStamperImp.java:123)","\tat com.lowagie.text.pdf.PdfStamper.(PdfStamper.java:130)","\tat com.lowagie.text.pdf.PdfStamper.createSignature(PdfStamper.java:707)","\tat net.sf.jsignpdf.SignerLogic.signFile(SignerLogic.java:204)","\tat net.sf.jsignpdf.Signer.signFiles(Signer.java:246)","\tat net.sf.jsignpdf.Signer.main(Signer.java:139)","","INFO Finished: Creating of signature failed."]
POST /ocs/v2.php/apps/libresign/api/v1/sign/uuid/9e99a3a6-c111-4090-8b80-7dd41c630c5f
von 2003:c1:9f04:6500:f329:f61d:e252:e99f von -- um 15.11.2024, 12:21:36

Describe the solution you'd like
Edit a document and then sign it.

@moritz76 moritz76 added the feature-request New feature request label Nov 15, 2024
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Nov 15, 2024
@vitormattos
Copy link
Member

vitormattos commented Nov 15, 2024

Can you provide more details about what you mean by "editing pdf"? Perhaps step by step so I can reproduce it using screenshots or a screen recording.

It seems like a very specific scenario and from the message, it seems that somehow the PDF has something that is being considered corrupted.

Can you share this PDF with me? You can attach it to this issue. If it is not possible to attach it to the issue because it may contain sensitive data, you can send it to me by email or Telegram. My contacts are on my GitHub profile.

@vitormattos vitormattos added bug Something isn't working and removed feature-request New feature request labels Nov 15, 2024
@moritz76
Copy link
Author

Thanks for your quick reply!

By "edit pdf" I mean that when you open a PDF document in a web browser such as Firefox, you have the option to write, draw or insert an image:
Bildschirmfoto vom 2024-11-15 16-24-07

It does not matter which pdf.

Here is what I see when I try to sign this edited PDF:
Bildschirmfoto vom 2024-11-15 16-26-03

I have also attached a sample document.
Testdocument-1.pdf

@vitormattos
Copy link
Member

@moritz76 Is this error occurring only after you edit the document? I made a test with your sample document with success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 0. Needs triage
Development

No branches or pull requests

2 participants