|
import asposepdfcloud |
|
from asposepdfcloud.PdfApi import PdfApi |
|
from asposepdfcloud.PdfApi import ApiException |
|
from asposepdfcloud.models import TextReplaceListRequest |
|
from asposepdfcloud.models import TextReplace |
|
|
|
|
|
import asposestoragecloud |
|
from asposestoragecloud.StorageApi import StorageApi |
|
from asposestoragecloud.StorageApi import ResponseMessage |
|
|
|
apiKey = "XXXXX" #sepcify App Key |
|
appSid = "XXXXX" #sepcify App SID |
|
apiServer = "http://api.aspose.com/v1.1" |
|
data_folder = "../../data/" |
|
|
|
#Instantiate Aspose Storage API SDK |
|
storage_apiClient = asposestoragecloud.ApiClient.ApiClient(apiKey, appSid, True) |
|
storageApi = StorageApi(storage_apiClient) |
|
#Instantiate Aspose Pdf API SDK |
|
api_client = asposepdfcloud.ApiClient.ApiClient(apiKey, appSid, True) |
|
pdfApi = PdfApi(api_client); |
|
# set input file name |
|
fileName = "sample-input.pdf" |
|
data_folde = "" |
|
name = "new-sample.pdf" |
|
try: |
|
# Instantiate Aspose Storage API SDK |
|
storage_apiClient = asposestoragecloud.ApiClient.ApiClient(apiKey, appSid, True) |
|
storageApi = StorageApi(storage_apiClient) |
|
|
|
# Instantiate Aspose Pdf API SDK |
|
api_client = asposepdfcloud.ApiClient.ApiClient(apiKey, appSid, True) |
|
pdfApi = PdfApi(api_client); |
|
|
|
|
|
# upload file to aspose cloud storage |
|
response = storageApi.PutCreate(fileName, data_folder + name) |
|
|
|
|
|
# invoke Aspose.Pdf Cloud SDK API to insert watermark image as stamp to a PDF page |
|
response = pdfApi.GetWordsPerPage(fileName) |
|
|
|
if response.Status == "OK": |
|
print("Words per page done") |
|
|
|
|
|
except ApiException as ex: |
|
print ("ApiException:") |
|
print ("Code:" + str(ex.code)) |
|
print ("Message:" +ex.message) |
|
|
|
|
|
|