-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdfsignature_example.py
35 lines (28 loc) · 4.47 KB
/
pdfsignature_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""In this example we show you how you can create a PDF signature with the Python SDK."""
import cloudofficeprint as cop
# Setup Cloud Office Print server
SERVER_URL = "https://api.cloudofficeprint.com/"
API_KEY = "YOUR_API_KEY" # Replace by your own API key
server = cop.config.Server(
SERVER_URL,
cop.config.ServerConfig(api_key=API_KEY)
)
# Create empty element collection
collection = cop.elements.ElementCollection()
# Add pdf signature
pdf_options = cop.config.PDFOptions(
sign_certificate="MIIKIQIBAzCCCecGCSqGSIb3DQEHAaCCCdgEggnUMIIJ0DCCBIcGCSqGSIb3DQEH\r\nBqCCBHgwggR0AgEAMIIEbQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQI7jl8\r\nNdR42qACAggAgIIEQHU5H+afTzuoQ2Y3KCz0NUPWO8LWeB9YhKe+K2zw8vzFTHgF\r\n1Z+A1v3ZoaZCjldO2+0DQamztbbydXu0a7vN+C+TqVrgchJDN7OnmzIIdyi7eFdX\r\ntIIuR4UPwPKS1Zj7EWpX8vJVL/pA1RIod3aV7mA7bGKfbaoZdn8MvVPfTxeIo5H4\r\njqPhIQnHRp2/2iJl1hd/c9IyD3U6B9O6YhwgzX/6CbdFT4PFy92XemhQh1voRZH3\r\nUzffQ0dF9Vpa01nu8hO9G3rzZIcxgskax4f4DAb4l4Ls15DGsL6eMqnCSdGANweV\r\n8G+498AjN/XS7fYdOZ5fMp8Eeswj9P8ZWYwdkWX2VqaEFFoTqgHsyzkEC7kXmen9\r\nGep/QFR86ZYfMLNSNQbKC/y0PyYbip/AsY03bdMXJmIP643ENA9LFHpkrLJZ0oA5\r\nbJGa+qzWwq2pIfbqXg9IRrZ6YYSHiAvv2aM0RvbfT9Qrmcsmj5FSENGchhW0rTF4\r\nJcNJQU2as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IV+G/BgeKTVGIeLMU+HToS/SRs6e/cDP56WnZJ11tfaqo6VF7oS280rFc/\r\nU/NXxfei/H4M+qRKip7rS9f8HT8SJqv2vS/gnAiAN/nEsWO8VAltWYzdm423kX50\r\ncTXrOh9yTZQwR5RiQ27ZxzPCjNmnLnu3AT1BYLYDlC0c1nQk/gR+VuQqe9Os+Iq0\r\nce6ccVONGSF0g3VQvXGEiIi1NSOFF+9DEnfyZoU8uk+lMGWUkyMuRsbLfyGjIrvx\r\npLyO7xOoXh9DxnnNFcyIIYOEQVHAVfWBLK3W6vJPmLTq8u0YdNChj8BNGcgRy80r\r\nND2x4JTWRHZgSUMMeCNdXsaDzcbVqCRfbWy609JM1P4pln21c4pMoSPiGWsfRnXD\r\nEj9mOowD8ywANCiEL5pnK0QW1kc/xutk+Lv0zw8JD/Z1+qY4yDUHOvQwlm5KQDXr\r\ntNWW5f4xoDvOsJBNILtNxgLH7FDu6XZT8YJS67kDbfX8hwcvI/de5zxdVURuZ9CG\r\nhU8vopL0VVXjFonVveIy+qFYD47pWl5joVv54/SP4eztZ0KNWN79/yLRRaJgoXIQ\r\nGzbf0HL+kzYWP8CJFhYTe3n3Qcj1NMbDzCdqonUnFuiCpOgmIh0D2b8pUpTBGJji\r\nZUW/MRqmUmjuakIxJTAjBgkqhkiG9w0BCRUxFgQUeN0jIHDtKgmwY5RxWfK7owDN\r\ncbswMTAhMAkGBSsOAwIaBQAEFEBhNddlELbh/oaKhL3Y8t8gyMBnBAgDeLLf4vCk\r\ntgICCAA="
)
conf = cop.config.OutputConfig(
pdf_options=pdf_options
)
# Create print job
printjob = cop.PrintJob(
data=collection,
server=server,
template=cop.Resource.from_local_file(
'./examples/pdfsignature_example/pdfsignature_template.pdf'),
output_config=conf
)
# Execute print job
printjob.execute().to_file('./examples/pdfsignature_example/output')