Skip to main content
Skip table of contents

.iText DITO Java API viText_DITO_1.3

Every iText DITO workflow starts with the creation of a template, exported to an iText DITO template package. This file will be at the center of the rest of the workflow. You’ll probably want to create output PDFs using the input data, following the output template.

Loading the License Key

Before you can use the SDK, you need to install the license key. iText DITO SDK for Docker users should refer to https://hub.docker.com/r/itext/dito-sdk, but for Java SDK users this is easily managed by using the following commands:


JAVA
File licenseKeyFile = ”...”; DitoLicense.loadLicenseFile(licenseKeyFile);


Setting up Proxy for Volume License AWS Calls

The proxy parameters for AWS calls can be configured with the environment variables HTTPS_PROXY(https_proxy) HTTP_PROXY(http_proxy) e.g:

JAVA
HTTPS_PROXY=https://127.0.0.1:8888;HTTP_PROXY=http://127.0.0.1:8888

Checking the Remaining Volume on your Subscription

We advise querying your remaining volume frequently and sending a warning message to your own application/system before the limit is reached and stops working.

For customers using the native Java iText DITO SDK you can call getRemainingProducePagesEvents using the API and this function will return the number of pages remaining on your volume license key. If you have a perpetual license, this call will return null.

For iText DITO API for Docker users it is even simpler. Simply call /api/license to display the expirationDate of your license key as well as the remaining volume.

PDF creation

One of the primary functions of iText DITO is the automatic creation of stylish and useful PDFs based on data gathered by the input form. If the template package contains an output template, all you need is the PdfProducer class from the com.itextpdf.dito.sdk. outputpackage. Creating a PDF using an output template and JSON data might look like this:


JAVA
File templatePackageFile = new File(templatePackagePath); String templateName = "output";

FileOutputStream fos = new FileOutputStream(new File(outFilePath)) String json = "{...}";



PdfProducer.convertTemplateFromPackage(templatePackageFile, templateName, fos, new JsonData(json));


You can also combine accepting data submissions and creating PDFs. That way, a PDF will be created for each filled out form. The example below shows how you can automate the workflow:

CODE
String json = DataSubmission.fromInputStream(is).asJsonString(); File templatePackageFile = new File(templatePackagePath);  String templateName = "output";

FileOutputStream fos = new FileOutputStream(new File(outFilePath)) String json = "{...}";



PdfProducer.convertTemplateFromPackage(templatePackageFile, templateName, fos, new JsonData(json));

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.