-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Comments
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. |
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: It does not matter which pdf. Here is what I see when I try to sign this edited PDF: I have also attached a sample document. |
@moritz76 Is this error occurring only after you edit the document? I made a test with your sample document with success. I was unable to reproduce the problem. |
Yes, the error only occurs after the document has been edited. It works fine without that. But in most cases I have to add a date or place to a document and then sign it. Okay, this is weird. I have tested it on several Nextcloud instances and I get this error on every one of them. Could you maybe open a document in Firefox, edit it and then try to sign it? Thank you very much! |
@moritz76 could you provide the steps that you made to do this? I used the document that you made changes and was possible sign the document. |
I have made a video about it: |
Curious, I made the same and can't reproduce the error. Follow the steps of my scenario: Go to app Files |
But this is basically the same thing I show in the video? |
Since we made the same, maybe could be related to your environment. Let's check if have anything else that could affect your environment:
Are you using SELinux? Your error is at JSignPDF side, other possible test is reproduce the signature using the same data that LibreSign used to sign the document. You can get the command changing this file: $commandSign = $this->commandSign($params);
file_put_contents('libresign.log', $commandSign);
exec($commandSign, $output); Then, try again to sign the file. After this, you will found the file libresign.log at root folder of your server. If you don't find it, run this: |
Thank you very much for your detailed reply!
Output of command occ libresign:configure:check
I add the new line in libresign/vendor/jsignpdf/jsignpdf-php/src/Sign/JSignService.php After trying to sign an edited PDF, I can see this in the libresign.log file: When execute the command I get this:
Same response when running as root or www-data |
Have 3 temp files created at /tmp folder and the tmp folder and the tmp folder is get from here: libresign/lib/Handler/JSignPdfHandler.php Line 51 in c8eacbe
The first file is the path to file to sign. In your case you can change to the absolute path to pdf file that you wish to sign. The second is the path to your .pfx file, this is the digital certificate that you will use to sign the document, after this, at The 3th is your visible signature. At the end of this command is the path to save the signed file. Then, the content of this temp file will be saved at final destination and them all temp files will be deleted. You can adjust all parameters to test with real data because every when you do a new sign will change the parameters. |
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: 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.
The text was updated successfully, but these errors were encountered: