How Tos

The samples and documentation here should get you quickly up and running with the PDF Services SDK. These code examples illustrate how to perform PDF actions using the SDK, including:

Service region configuration

Adobe PDF Services SDKs use US (United States) as a default region to process all the documents. Once you purchase PDF Services SDK, the SDKs can be configured to process the documents in a specified region that is listed below. Currently, PDF Services SDKs has support for the following regions :

Region Code
Name
US
United States (default)
EU
Europe

In addition to the details below, you can refer to working code samples:

Available properties:

Override the region property via a custom ClientConfig class:

data-slots=heading, code
data-repeat=4
data-languages=Java, .NET, Node JS, Python

Java

ClientConfig clientConfig = ClientConfig.builder()
    .setRegion(Region.EU)
    .build();

.NET

ClientConfig clientConfig = ClientConfig.ConfigBuilder()
    .SetRegion(Region.EU)
    .Build();

Node.js

const clientConfig = new ClientConfig({
    region: Region.EU
});

Python

client_config = ClientConfig(
    region=Region.US
)

Proxy Server Configuration

The Java and Node SDK enables connection to API calls through Proxy via Client Configurations. Also, it supports username and password based authentication for the proxy server. It allows the clients to use SDK within the network where all outgoing calls have to go through a proxy and are allowed only if allow-listed on the proxy. Please refer to the following sample for details.

Java

Java Proxy Server configuration

Available properties:

Node.js

Node Proxy Server configuration

Available properties:

Python

Python Proxy Server configuration

Available properties:

All these properties are wrapped within the proxyServerConfig object. Further, username and password is to be provided inside the nested object usernamePasswordCredentials.

Set the above properties using a custom ProxyServerConfig class, and use ClientConfig class to configure proxy server.

Sample showing proxy server configuration without authentication.

data-slots=heading, code
data-repeat=3
data-languages=Java, Node JS, Python

Java

ProxyServerConfig proxyServerConfig = new ProxyServerConfig.Builder()
    .withHost("PROXY_HOSTNAME")
    .withProxyScheme(ProxyScheme.HTTPS)
    .withPort(443)
    .build();

ClientConfig clientConfig = ClientConfig.builder()
    .withConnectTimeout(10000)
    .withSocketTimeout(40000)
    .withProxyServerConfig(proxyServerConfig)
    .build();

Node.js

const proxyServerConfig = new ProxyServerConfig({
    host: "PROXY_HOSTNAME",
    port: 443,
    scheme: ProxyScheme.HTTP
});

const clientConfig = new ClientConfig({
    proxyServerConfig
});

Python

proxy_server_config = ProxyServerConfig(
    host="PROXY_HOSTNAME",
    port=443,
    scheme=ProxyScheme.HTTP,
)

client_config = ClientConfig(
    proxy_server_config=proxy_server_config
)

Sample showing proxy server configuration with authentication.

data-slots=heading, code
data-repeat=3
data-languages=Java, Node JS, Python

Java

ProxyServerConfig proxyServerConfig = new ProxyServerConfig.Builder()
    .withHost("PROXY_HOSTNAME")
    .withProxyScheme(ProxyScheme.HTTPS)
    .withPort(443)
    .withCredentials(new UsernamePasswordCredentials("USERNAME", "PASSWORD"))
    .build();

ClientConfig clientConfig = ClientConfig.builder()
    .withConnectTimeout(10000)
    .withSocketTimeout(40000)
    .withProxyServerConfig(proxyServerConfig)
    .build();

Node.js

const proxyServerConfig = new ProxyServerConfig({
    host: "PROXY_HOSTNAME",
    port: 443,
    scheme: ProxyScheme.HTTP,
    credentials: new UsernamePasswordCredentials({
        username: "USERNAME",
        password: "PASSWORD"
    })
});

const clientConfig = new ClientConfig({
    proxyServerConfig
});

Python

proxy_server_config = ProxyServerConfig(
    host="PROXY_HOSTNAME",
    port=443,
    scheme=ProxyScheme.HTTP,
    credentials=UsernamePasswordCredentials(
        username="USERNAME",
        password="PASSWORD"
    )
)

client_config = ClientConfig(
    proxy_server_config=proxy_server_config
)

Custom timeout configuration

The APIs use inferred timeout properties and provide defaults. However, the SDK supports custom timeouts for the API calls. You can tailor the timeout settings for your environment and network speed. In addition to the details below, you can refer to working code samples:

Java timeout configuration

Available properties:

Override the timeout properties via a custom ClientConfig class:

data-slots=heading, code
data-repeat=1
data-languages=Java
ClientConfig clientConfig = ClientConfig.builder()
    .withConnectTimeout(3000)
    .withSocketTimeout(20000)
    .build();

.NET timeout configuration

Available properties:

Override the timeout properties via a custom ClientConfig class:

data-slots=heading, code
data-repeat=1
data-languages=.NET
ClientConfig clientConfig = ClientConfig.ConfigBuilder()
    .WithTimeout(40000)
    .Build();

Node.js timeout configuration

Available properties:

Override the timeout properties via a custom ClientConfig class:

data-slots=heading, code
data-repeat=1
data-languages=Node JS
const clientConfig = new ClientConfig({
    timeout: 15000
})

Python timeout configuration

Available properties:

Override the timeout properties via a custom ClientConfig class:

data-slots=heading, code
data-repeat=1
data-languages=Python
client_config = ClientConfig(
    connect_timeout=4000,
    read_timeout=10000
)