Edit Signatures in Signed PDF Documents using Python

Electronic signatures are as simple as a name entered in electronic documents. These are increasingly used in e-commerce and in regulatory filings. E-signatures represent the data in the visually encoded form used by the signatory to sign the documents electronically. As a Python developer, you can electronically edit signatures in your signed PDF documents programmatically on the cloud. This article will be focusing on how to edit signatures in signed PDF documents using a REST API in Python.

The following topics shall be covered in this article:

Document Signature REST API and Python SDK

groupdocs_signature-for-cloud

For editing e-signatures in a PDF document, I will be using the Python SDK of GroupDocs.Signature Cloud API. It enables you to electronically secure documents and images for supported file formats by applying text, stamp, QR-code, barcode, image, and digital signatures. You can also create, verify, delete and search different types of signatures easily. It also provides .NETJavaPHPAndroidRuby, and Node.js SDKs as its document signature family members for the Cloud API.

You can install GroupDocs.Signature Cloud to your Python project with pip (package installer for python) using the following command in the console:

pip install groupdocs_signature_cloud

Please get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Add your ID and secret in the code as demonstrated below:

Edit Signatures in Signed PDF Documents using a REST API in Python

You can edit signatures in signed PDF documents by following the simple steps mentioned below:

Upload the Document

First of all, upload the signed PDF document to the Cloud using the code example given below:

As a result, the uploaded PDF file (signed.pdf) will be available in the files section of your dashboard on the cloud.

Update Signatures in Signed PDF Documents using Python

You can update the signatures in a signed PDF file programmatically by following the steps mentioned below.

  • Create an instance of SignApi
  • Set path to the signed PDF file
  • Search QR Code by providing SearchQRCodeOptions and SearchSettings
  • Create SearchSignatureRequest
  • Get results by calling the SignApi.search_signatures() method
  • Define UpdateOptions
  • Set UpdateSettings
  • Assign UpdateOptions to UpdateSettings
  • Create UpdateSignaturesRequest
  • Get results by calling the SignApi.update_signatures() method

The following code snippet shows how to update QR Code signatures in a signed PDF document using a REST API.

Update Signatures in Signed PDF Document using Python
Update Signatures in Signed PDF Document using Python

Download the Signed File

The above code sample will save the updated PDF file on the cloud which can be downloaded using the following code sample:

Search and Replace E-Signatures using Python

You can search and replace the signatures in a signed PDF document programmatically by following the steps given below.

  • Create an instance of SignApi
  • Set path to the signed PDF file
  • Search QR Code
    • Define SearchQRCodeOptions and SearchSettings
    • Create SearchSignatureRequest
    • Get results by calling the SignApi.search_signatures() method
  • Delete the searched QR Code
  • Sign with Barcode
    • Define SignBarcodeOptions
    • Set barcode size and position
    • Define SignSettings
    • Assign SignBarcodeOptions and SaveOptions to SignSettings
    • Create CreateSignaturesRequest
    • Get results by calling the SignApi.create_signatures() method

The following code snippet shows how to search QR Code signature and replace it with a Barcode signature in a signed PDF document using a REST API. Please follow the steps mentioned earlier to download the updated file.

Search and Replace Signatures in Signed PDF Document using Python
Search and Replace Signatures in Signed PDF Document using Python

Try Online

Please try the following free online PDF signature tool, which is developed using the above API. https://products.groupdocs.app/signature/pdf

Conclusion

In this article, you have learned how to update signatures in signed PDF documents. You also learned how to search and replace signatures in signed PDF documents on the cloud. This article also explained how to programmatically upload a PDF file on the cloud and then download the signed file from the cloud. You can learn more about GroupDocs.Signature Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser. In case of any ambiguity, please feel free to contact us on the forum.

See Also