Created
April 15, 2021 06:35
-
-
Save groupdocs-cloud-gists/5da9ba3dd881dccefe7f76467454d837 to your computer and use it in GitHub Desktop.
Electronically remove signatures from your signed PDF documents programmatically using a REST API in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove Signatures from a Signed PDF Documents | |
1. Programmatically upload a PDF file on the cloud | |
2. Search and Remove signatures from a Signed PDF document programmatically using Python. | |
4. Download the signed file from the cloud. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create instance of the API | |
client_id = "112f0f38-9dae-42d5-b4fc-cc84ae644972" | |
client_secret = "16ad3fe0bdc39c910f57d2fd48a5d618" | |
configuration = groupdocs_signature_cloud.Configuration(client_id, client_secret) | |
configuration.api_base_url = "https://api.groupdocs.cloud" | |
my_storage = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# API initialization | |
file_api = groupdocs_signature_cloud.FileApi.from_config(configuration) | |
# download file request | |
request = groupdocs_signature_cloud.DownloadFileRequest("signed.pdf", my_storage) | |
response = file_api.download_file(request) | |
# Move downloaded file to your working directory | |
shutil.move(response, "C:\\Files\\") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create necessary API instances | |
api = groupdocs_signature_cloud.SignApi.from_keys(client_id, client_secret) | |
# signed document path | |
fileInfo = groupdocs_signature_cloud.FileInfo() | |
fileInfo.file_path = "signed.pdf" | |
# Search | |
opts = groupdocs_signature_cloud.SearchBarcodeOptions() | |
opts.page = 1 | |
opts.signature_type = 'Barcode' | |
settings = groupdocs_signature_cloud.SearchSettings() | |
settings.options = [opts] | |
settings.file_info = fileInfo | |
request = groupdocs_signature_cloud.SearchSignaturesRequest(settings) | |
response = api.search_signatures(request) | |
# Delete | |
opts = groupdocs_signature_cloud.DeleteOptions() | |
opts.page = 1 | |
opts.signature_type = 'Barcode' | |
opts.signature_id = response.signatures[0].signature_id | |
settings = groupdocs_signature_cloud.DeleteSettings() | |
settings.options = [opts] | |
settings.file_info = fileInfo | |
request = groupdocs_signature_cloud.DeleteSignaturesRequest(settings) | |
response = api.delete_signatures(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create instance of the API | |
file_api = groupdocs_signature_cloud.FileApi.from_config(configuration) | |
# upload sample file | |
request = groupdocs_signature_cloud.UploadFileRequest("signed.pdf", "C:\\Files\\signed.pdf", my_storage) | |
response = file_api.upload_file(request) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment