Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import asposepdfcloud
- from asposepdfcloud.apis.pdf_api import PdfApi
- # Get App key and App SID from https://aspose.cloud
- pdf_api_client = asposepdfcloud.api_client.ApiClient(
- app_key='xxxxx',
- app_sid='xxxxx')
- pdf_api = PdfApi(pdf_api_client)
- filename = 'sample.pdf'
- remote_name = 'sample.pdf'
- #upload PDF file to storage
- pdf_api.upload_file(remote_name,filename)
- #Replace Text
- text_replace1 = asposepdfcloud.models.TextReplace(old_value='name',new_value='Richard',regex='true')
- text_replace2 = asposepdfcloud.models.TextReplace(old_value='phone',new_value='unknown',regex='true')
- text_replace_list = asposepdfcloud.models.TextReplaceListRequest(text_replaces=[text_replace1,text_replace2])
- response = pdf_api.post_document_text_replace(remote_name, text_replace_list)
- print(response)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement