signpdf | Python script to add signature images to PDFs | Image Editing library

 by   yourcelf Python Version: 0.0.3 License: MIT

kandi X-RAY | signpdf Summary

kandi X-RAY | signpdf Summary

signpdf is a Python library typically used in Media, Image Editing, Nodejs applications. signpdf has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install signpdf' or download it from GitHub, PyPI.

A quick script to add signature images to PDFs, because I couldn’t find anything that worked well for the purpose under Linux. Pros: should work with most PDFs, and with signatures as PNG’s or JPG’s. It preserves the incoming PDF’s text format (e.g. doesn’t convert every page to images like some alternatives). Cons: no gui yet.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              signpdf has a low active ecosystem.
              It has 37 star(s) with 19 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 2 open issues and 2 have been closed. On average issues are closed in 352 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of signpdf is 0.0.3

            kandi-Quality Quality

              signpdf has 0 bugs and 1 code smells.

            kandi-Security Security

              signpdf has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              signpdf code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              signpdf is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              signpdf releases are not available. You will need to build from source code and install.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              signpdf saves you 27 person hours of effort in developing the same functionality from scratch.
              It has 74 lines of code, 4 functions and 2 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed signpdf and discovered the below as its top functions. This is intended to give you an instant insight into signpdf implemented functionality, and help decide if they suit your requirements.
            • Sign a PDF file
            • Get a temporary filename
            • Read file contents
            Get all kandi verified functions for this library.

            signpdf Key Features

            No Key Features are available at this moment for signpdf.

            signpdf Examples and Code Snippets

            No Code Snippets are available at this moment for signpdf.

            Community Discussions

            QUESTION

            how to digitally sign a PDF document with a certificat using Javascript?
            Asked 2022-Mar-27 at 19:41

            i was looking for a solution to digitally sign a pdf with a self-signed certificat and came across a video in youtube explaining the process using pdf-lib and node-signpdf libraries. However, after following the instructions it didnt work as intended and encountered a problem:

            • i executed the command ( npm i ) and (npm start ) as shown in the github repo of the project.

            repo : https://github.com/RichardBray/pdf_sign

            Demo ( 8 mins video ) : https://www.youtube.com/watch?v=OFZK5lc70OI&list=PLXUfmx2SIgyICZP-rA84Sle_ghq30W89N&index=4&t=1s

            ...

            ANSWER

            Answered 2022-Mar-27 at 19:41

            it appears that the problem is OS related. In fact , the code works fine under linux OS but have some issues with Windows OS related to import command. For windows OS replacing "import" commands with "require" commands solves the problem.

            BEFORE:

            Source https://stackoverflow.com/questions/71617826

            QUESTION

            Sign a PDF using SmartCard
            Asked 2022-Feb-16 at 17:27

            I have tried to sign pdf using a smart card with Node JS chilkat but it fails. and I found this error when I put the smart card and install here driver on my computer then I execute my code : I cannot find the best solution

            ...

            ANSWER

            Answered 2022-Feb-16 at 17:27

            I uploaded a new build here: https://www.npmjs.com/package/@chilkat/ck-node14-win64 It is the version "9.50.89-hotfix1".

            Please give it a try. Also, I see you are passing "TnTrust Token" to LoadFromSmartCard. If the problem remains, try passing an empty string. This should cause Chilkat to try using the default Microsoft CNG Storage Provider, which may have better success.

            Source https://stackoverflow.com/questions/71141816

            QUESTION

            Certified Document when Approval Signature exist
            Asked 2022-Jan-25 at 10:00

            Working with java use Apache PDFBox to sign and certified, invalid certified if signature exist, with JsignPDF was able to certified when approval exist, the process is sign after that do certified (seal) document

            Signature with JsignPDF

            document after certified with JsignPDF :

            the certified invalid with PDFBox

            the function from PDFBox with some editing was to try :

            ...

            ANSWER

            Answered 2022-Jan-25 at 10:00

            This answer essentially is a more detailed version of the comments, essentially finding that what you want to do is not possible.

            You ask for a way to

            Certify Document when Approval Signature exist

            According to the current PDF specification:

            ISO 32000-2:2020 subsection 12.8.1 "General" of 12.8 "Digital signatures" A PDF document may contain the following standard types of signatures: [...] One or more approval signatures (also known as recipient signatures). These shall follow the certification signature if one is present.

            Thus, you cannot validly add a certification signature to a PDF which already has approval signatures.

            (This does not automatically mean that all validators will detect the issue if you add a certification signature after approval signatures, let alone correctly display the cause. Many validators only do a subset of the checks that strictly speaking are necessary...)

            More question if the certification signature come first then next is approval like 3 signature approval, can the last the certification setMDPPermission with 1 ? so at the end the document can't add more approval signature

            setMDPPermission adds a DocMDP transform to the signature, and such a transform makes the signature a certification signature. Thus, using this method when signing a document that already has an approval signature, will create an invalid PDF or fail entirely.

            You can lock a PDF document with an approval signature, though, if you add a Lock dictionary to the signature field with a P entry of 1. Beware, though, this is a ISO 32000-2 feature originally introduced as a feature of an Adobe Extension to ISO 32000-1. Not all PDF viewers support ISO 32000-2 yet, so some viewers may not respect this entry.

            Source https://stackoverflow.com/questions/70843036

            QUESTION

            PDFBox - sign PDF have existing signed by another
            Asked 2021-Sep-13 at 09:12

            Trying to sign a PDF existing signed with PDFBox

            with this test function :

            ...

            ANSWER

            Answered 2021-Sep-13 at 09:12

            The error message "DocMDP transform method not allowed if an approval signature exists" is correct.

            If you want to add a signature to an already signed PDF, simply remove the

            Source https://stackoverflow.com/questions/69159496

            QUESTION

            Android - I'm trying to draw a Path on a Canvas so i can draw a signature on top of a Bitmap, but the signature is misaligned
            Asked 2021-Feb-19 at 10:29

            I am trying to create a simple app where i can draw a signature over a pdf page that has been turned into a Bitmap. I'm successful on implementing the PDF feature but i'm having trouble implementing the SignaturePad feature in my app.

            When i draw on my SignaturePad view, it draws exactly where i dragged on screen. Image: Signature on the drawing pad

            However, when i display the resulting bitmap, the signature appears bigger and off-positioned. Image: Signature after displaying the resulting bitmap

            I have tried multiple solution offerred to a closely-related problems like:

            but none of them worked.

            I have 0 (zero) experience of using the android.graphics library so i am clueless about what i'm doing wrong. Any help or suggestions are greatly appreciated!

            My SignaturePad Class:

            ...

            ANSWER

            Answered 2021-Feb-19 at 10:29

            I figured it out. I logged the width and the height of my custom view on the overridden setImageBitmap function. Both returns zero. So i logged them again in the onLayout function, and both of them returns the actual width and height of my custom view.

            Finally, i decided to use drawBitmap() instead of setBitmap() to resize the bitmap and moved a couple of lines from the setImageBitmap function to the bottom of onLayout function.

            Source https://stackoverflow.com/questions/66256771

            QUESTION

            Howto keep PDF-A when signing a document using IText SignDeferred
            Asked 2020-Nov-27 at 08:00

            I do apply a signature to a pdf document via delayed signing(SignDeferred) using IText. The process contains the following steps:

            • Prepare the pdf document for siging
              • Reserve space for the signature in the pdf document
            • Create the hash value of the pdf document
            • Create the signature based on the hash value
              • Using a self signed certificate
            • Apply the signature to the pdf document

            The whole process works and i end with a pdf document where the signature is set and is valid.

            The original pdf is a PDF-A1a but the resulting pdf is not a valid PDF-A1a anymore. I am aware that there is a documentation about IText PDF-A support (https://kb.itextpdf.com/home/it7kb/ebooks/itext-7-jump-start-tutorial-for-java/chapter-7-creating-pdf-ua-and-pdf-a-documents), but this seems to not apply since i don't change the content of the document.

            My question: How can i apply a signature using deferred signing and keep the PDF-A1a in the resulting document?

            Note: If i do apply a signature directly (Without SignDeferred), the resulting pdf is still a PDF-A1a, but i do have to use SignDeferred Note: I do use https://www.pdfen.com/pdf-a-validator for checking pdf-A

            Code sample
            • Component used for signing:
              • itext.sign 7.1.5.0
              • itext.kernel 7.1.5.0
            • Component used for creating hash
              • BouncyCastle.Crypto 1.8.1.0

            The following is a complete code sample sample with everything required in one file. It only requires the references to itext and BouncyCastle and the path to a self signed certificate

            ...

            ANSWER

            Answered 2020-Nov-27 at 08:00

            It seems the reason why the signed pdf is no longer a valid PDF-A1a is the estimated size for the signature. I have used a value of about 120kb for the signature.

            Source https://stackoverflow.com/questions/65024482

            QUESTION

            Java PDF signing error org.bouncycastle.asn1.ASN1UTCTime incompatible with org.bouncycastle.asn1.ASN1Set
            Asked 2020-Nov-18 at 17:21

            I m trying to sign PDF on the fly. which i clearly fail to do so. Any help is appreciated.

            This is just a test for signing pdf. For the later purpose i'll be saving those private and public key.

            The intend is to generate sign PDF on the fly. i followed the code shown in this link

            Following are the code snippets.

            ...

            ANSWER

            Answered 2020-Nov-18 at 17:21

            thanks to mkl

            i was able to solve the issue by updating openpdf version

            updated maven config is

            Source https://stackoverflow.com/questions/64892580

            QUESTION

            "Unexpected byte range values defining scope of signed data" when signing a pdf
            Asked 2020-Nov-16 at 14:56

            I use a modified version of this library: https://github.com/vbuch/node-signpdf#readme in an angular app to sign a pdf with a signature that has been created elsewhere. When I open the signed pdf with foxit reader the signature is invalid with the following message:

            Unexpected byte range values defining scope of signed data

            Any ideas what the problem could be?

            Here is the file: https://drive.google.com/file/d/1eS2waysotpAx6VtHMNvhGvl3wqgiyoT7/view?usp=sharing

            ...

            ANSWER

            Answered 2020-Nov-16 at 14:56
            First Example Document

            I couldn't reproduce the “Unexpected byte range values defining scope of signed data” error message with the first example document, Foxit "merely" complained that the signature was invalid. Which it indeed is because you forgot to base64-decode the signature string before injecting it into the PDF - PDF requires the embedded signature containers in DER format.

            Second Example Document

            The second example document was shared in a comment:

            Now I don't get the error about the byte range anymore but I get new errors: "The document has been altered or corrupted since the Signature was applied." and "The Signer's identity is invalid because it has expired or is not yet valid." and "The signature includes an embedded timestamp but it could not be verified." Not sure if I'm doing it correctly now. This is the new file: https://drive.google.com/file/d/1vsa7thwCsi04r68cdcIsfJG7cT2__-d9/view?usp=sharing

            Indeed, the signature container now is injected in DER format, so Foxit Reader can validate it. Concerning the new error messages:

            "The document has been altered or corrupted since the Signature was applied." - this indicates here that there is some digest value mismatch.

            Calculating and extracting the digest values in question shows that the SHA256 digest value of the signed byte ranges of the document is

            Source https://stackoverflow.com/questions/64802512

            QUESTION

            Digital signature not visible in Adobe reader but visible in Foxit reader
            Asked 2020-Nov-03 at 17:57

            I'm using this library https://github.com/vbuch/node-signpdf to sign a pdf document. After I have signed the document I can see the signature when I open the pdf with Foxit reader but not when I open it with Adobe reader DC. I also tried Adobe reader XI but there I can't see it either. When I open the document in pdf xchange viewer I get this error: non critical errors detected in the xref table.

            Any ideas what the problem could be?

            That's the file I signed: https://drive.google.com/file/d/1AZvS4sP2Y3FwW4Deod87Dgxc9I0QZkoc/view?usp=sharing

            ...

            ANSWER

            Answered 2020-Nov-03 at 17:57

            In your example PDF the name of the signature field consists of 10 bytes, 9 bytes with value 0x00 and one byte with value 0x01. Apparently Adobe Reader does not like that field name.

            After some experiments it looks like Adobe Reader does not like a field name starting with a 0x00 byte.

            Maybe it contains some code that determines string lengths in a c'ish manner and interprets a 0x00 as end-of-string. A field name with a leading 0x00 byte, therefore, is interpreted as empty string, a field name not accepted by Adobe Reader either.

            Thus, please use a signature field name made of (in particular starting with) some meaningful characters. As validators usually display the name of the signature field, this is a good idea anyways.

            In terms of lowlevel PDF objects:

            The signature field object looks like this:

            Source https://stackoverflow.com/questions/64647990

            QUESTION

            Sign PDF in a modern browser natively?
            Asked 2020-Jun-29 at 08:51
            What I'm trying to achieve
            • Sign a PDF in the browser using cliets certificate store or Smart Card
            What I did so far
            1. For accessing the local cert store I use FortifyApp.
            2. Pdf is pre-signed on the server using iText(Sharp), then sent to the client via Ajax. Relevant code:
            ...

            ANSWER

            Answered 2020-Jun-29 at 08:51

            So I figured it out.

            Can I achieve my goal without having to manually upload a p12/pfx file, is it even possible?

            Yes, it is. (See below on what needs to be changed.)

            Is the server-side implementation of the deferred signature correct, do I need something else?

            Yes, the code above is fine.

            Is the pdf manipulation in javascript correct?

            Also fine.

            Can I transform the native CrytpoKey to forge or pkijs?

            Yes, see below.

            What is wrong with the last signature?

            @mkl answered it in a comment, thank you.

            FortifyApp has a CMS demo now. Although it didn't work with the version I was using, it works with version 1.3.4.

            So I went with the pki.js implementation. The code changes need for the signing to be successful are the following:

            1. Export the certificate:

            Source https://stackoverflow.com/questions/62472562

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install signpdf

            You can install using 'pip install signpdf' or download it from GitHub, PyPI.
            You can use signpdf like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install signpdf

          • CLONE
          • HTTPS

            https://github.com/yourcelf/signpdf.git

          • CLI

            gh repo clone yourcelf/signpdf

          • sshUrl

            git@github.com:yourcelf/signpdf.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link