pdftools_sdk.sdk
Classes
|
SDK initialization and product information |
- class pdftools_sdk.sdk.Sdk(handle)[source]
Bases:
_NativeObject
SDK initialization and product information
- static initialize(license: str, producer_suffix: str | None = None) None [source]
Initialize the product and the license key.
Before calling any of the other functions of the SDK, a license key must be set by calling this method. For licensing questions, contact pdfsales@pdftools.com <mailto:pdfsales@pdftools.com>.
- Parameters:
license (str) – The license key. The format of the license key is “<PDFSDK,V1,…>”
producerSuffix (Optional[str]) – If neither None nor empty, this string is appended to the producer string within metadata of PDF output documents (see
pdftools_sdk.sdk.Sdk.producer_full_name
).
- Raises:
pdftools_sdk.unknown_format_error.UnknownFormatError – The format (version) of the license argument is unknown.
pdftools_sdk.corrupt_error.CorruptError – The license argument is not a correct license key.
pdftools_sdk.license_error.LicenseError – The license argument can be read but the license check failed.
pdftools_sdk.http_error.HttpError – A network error occurred.
- static add_font_directory(directory: str) None [source]
Add custom font directory
- Parameters:
directory (str) – The path of the directory which contains additional font files to be considered during processing.
- Raises:
pdftools_sdk.not_found_error.NotFoundError – The given directory path does not exist.
- static set_producer_suffix(val: str | None) None [source]
The suffix for the producer
Suffix that is appended to the producer string within metadata of PDF output documents (see
pdftools_sdk.sdk.Sdk.producer_full_name
).- Parameters:
val (Optional[str]) – property value
- static get_producer_full_name() str [source]
The producer string that is set within the metadata of PDF output documents
The producer string depends on the license key and producer suffix set in
pdftools_sdk.sdk.Sdk.initialize()
.- Returns:
str
- static get_proxy() str | None [source]
Proxy to use for all communication to remote servers
The SDK can use a proxy for all HTTP and HTTPS communication.
The default is None, i.e. no proxy is used. Otherwise the property’s value must be a URI with the following elements:
http[s]://[‹user›[:‹password›]@]‹host›[:‹port›]
Where:
http/https: Protocol for connection to proxy.
‹user›:‹password› (optional): Credentials for connection to proxy (basic authorization).
‹host›: Hostname of proxy.
‹port›: Port for connection to proxy.
Example: “http://myproxy:8080”
For SSL/TLS connections, e.g. to a signature service, the proxy must allow the HTTP CONNECT request to the remote server.
- Returns:
Optional[str]
- static set_proxy(val: str | None) None [source]
Proxy to use for all communication to remote servers
The SDK can use a proxy for all HTTP and HTTPS communication.
The default is None, i.e. no proxy is used. Otherwise the property’s value must be a URI with the following elements:
http[s]://[‹user›[:‹password›]@]‹host›[:‹port›]
Where:
http/https: Protocol for connection to proxy.
‹user›:‹password› (optional): Credentials for connection to proxy (basic authorization).
‹host›: Hostname of proxy.
‹port›: Port for connection to proxy.
Example: “http://myproxy:8080”
For SSL/TLS connections, e.g. to a signature service, the proxy must allow the HTTP CONNECT request to the remote server.
- Parameters:
val (Optional[str]) – property value
- static get_http_client_handler() HttpClientHandler [source]
The default handler for communication to remote servers
This instance is used wherever there is no dedicated HTTP client handler parameter.
- Returns:
pdftools_sdk.http_client_handler.HttpClientHandler
- static get_usage_tracking() bool [source]
Property denoting whether the usage tracking is enabled or disabled
The SDK is allowed to track usage when this property is set to True. The collected data includes only non-sensitive information, such as the features used, the document type, the number of pages, etc.
The default is True, i.e. usage tracking is enabled.
- Returns:
bool
- static set_usage_tracking(val: bool) None [source]
Property denoting whether the usage tracking is enabled or disabled
The SDK is allowed to track usage when this property is set to True. The collected data includes only non-sensitive information, such as the features used, the document type, the number of pages, etc.
The default is True, i.e. usage tracking is enabled.
- Parameters:
val (bool) – property value
- static get_licensing_service() str [source]
Licensing service to use for all licensing requests
This property is relevant only for page-based licenses and is used to set the Licensing Gateway Service.
The default is “https://licensing.pdf-tools.com/api/v1/licenses/” for the online Pdftools Licensing Service. If you plan to use the Licensing Gateway Service instead of the Pdftools Licensing Service, the property’s value must be a URI with the following elements:
http[s]://[‹user›[:‹password›]@]‹host›[:‹port›]
Where:
http/https: Protocol for connection to the Licensing Gateway Service.
‹user›:‹password› (optional): Credentials for connection to the Licensing Gateway Service (basic authorization).
‹host›: Hostname of the Licensing Gateway Service.
‹port›: Port for connection to the Licensing Gateway Service.
Example: “http://localhost:9999”
- Returns:
str
- static set_licensing_service(val: str) None [source]
Licensing service to use for all licensing requests
This property is relevant only for page-based licenses and is used to set the Licensing Gateway Service.
The default is “https://licensing.pdf-tools.com/api/v1/licenses/” for the online Pdftools Licensing Service. If you plan to use the Licensing Gateway Service instead of the Pdftools Licensing Service, the property’s value must be a URI with the following elements:
http[s]://[‹user›[:‹password›]@]‹host›[:‹port›]
Where:
http/https: Protocol for connection to the Licensing Gateway Service.
‹user›:‹password› (optional): Credentials for connection to the Licensing Gateway Service (basic authorization).
‹host›: Hostname of the Licensing Gateway Service.
‹port›: Port for connection to the Licensing Gateway Service.
Example: “http://localhost:9999”
- Parameters:
val (str) – property value
- Raises:
ValueError – The URI is invalid.
- static get_license_info_snapshot() LicenseInfo [source]
A new snapshot is created whenever this property is accessed.
Note:
pdftools_sdk.sdk.Sdk.initialize()
/>*must* be called before accessing license information. Otherwise, the license is considered invalid.- Returns:
pdftools_sdk.license_info.LicenseInfo