Package com.pdftools

Class Sdk


  • public class Sdk
    extends NativeObject

    SDK initialization and product information

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static HttpClientHandler getHttpClientHandler()
      The default handler for communication to remote servers (Getter)
      static LicenseInfo getLicenseInfoSnapshot()
      A new snapshot is created whenever this property is accessed.
      static java.net.URI getLicensingService()
      Licensing service to use for all licensing requests (Getter)
      static java.lang.String getProducerFullName()
      The producer string that is set within the metadata of PDF output documents (Getter)
      static java.net.URI getProxy()
      Proxy to use for all communication to remote servers (Getter)
      static boolean getUsageTracking()
      Property denoting whether the usage tracking is enabled or disabled (Getter)
      static java.lang.String getVersion()
      The version of the SDK (Getter)
      static void initialize​(java.lang.String license)
      Initialize the product and the license key.
      static void initialize​(java.lang.String license, java.lang.String producerSuffix)
      Initialize the product and the license key.
      static void setLicensingService​(java.net.URI value)
      Licensing service to use for all licensing requests (Setter)
      static void setProxy​(java.net.URI value)
      Proxy to use for all communication to remote servers (Setter)
      static void setUsageTracking​(boolean value)
      Property denoting whether the usage tracking is enabled or disabled (Setter)
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • initialize

        public static void initialize​(java.lang.String license,
                                      java.lang.String producerSuffix)
                               throws LicenseException,
                                      UnknownFormatException,
                                      CorruptException

        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.
        Parameters:
        license - The license key. The format of the license key is "<4H,V1,PDFSDK,...>"
        producerSuffix - If neither null nor empty, this string is appended to the producer string within metadata of PDF output documents (see getProducerFullName()).
        Throws:
        UnknownFormatException - The format (version) of the license argument is unknown.
        CorruptException - The license argument is not a correct license key.
        LicenseException - The license argument can be read but the license check failed.
        java.lang.IllegalArgumentException - if license is null
      • getVersion

        public static java.lang.String getVersion()

        The version of the SDK (Getter)

      • getProducerFullName

        public static java.lang.String getProducerFullName()

        The producer string that is set within the metadata of PDF output documents (Getter)

        The producer string depends on the license key and producer suffix set in initialize(java.lang.String).
      • getProxy

        public static java.net.URI getProxy()

        Proxy to use for all communication to remote servers (Getter)

        The SDK can use a proxy for all HTTP and HTTPS communication.

        The default is null, 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.

      • setProxy

        public static void setProxy​(java.net.URI value)

        Proxy to use for all communication to remote servers (Setter)

        The SDK can use a proxy for all HTTP and HTTPS communication.

        The default is null, 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.

      • getHttpClientHandler

        public static HttpClientHandler getHttpClientHandler()

        The default handler for communication to remote servers (Getter)

        This instance is used wherever there is no dedicated HTTP client handler parameter.
      • getUsageTracking

        public static boolean getUsageTracking()

        Property denoting whether the usage tracking is enabled or disabled (Getter)

        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.

      • setUsageTracking

        public static void setUsageTracking​(boolean value)

        Property denoting whether the usage tracking is enabled or disabled (Setter)

        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.

      • getLicensingService

        public static java.net.URI getLicensingService()

        Licensing service to use for all licensing requests (Getter)

        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"

      • setLicensingService

        public static void setLicensingService​(java.net.URI value)

        Licensing service to use for all licensing requests (Setter)

        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"

        Throws:
        java.lang.IllegalArgumentException - The URI is invalid.
        java.lang.IllegalArgumentException - if value is null
      • getLicenseInfoSnapshot

        public static LicenseInfo getLicenseInfoSnapshot()

        A new snapshot is created whenever this property is accessed.

        Note: initialize(java.lang.String) must be called before accessing license information. Otherwise, the license is considered invalid.