Documentation

Local REST API for synchronous PDF generation from structured JSON data.

Quick Test (1 minute)

Note: The sandbox is not the actual product. OnPremPDF is installed locally and exposes the API on your own server at http://{server-ip}:8080/pdfguard/api/v1/render.


curl -X POST https://sandbox.onprempdf.com/pdfguard/api/v1/render \
  -H "Content-Type: application/json" \
  -d '{
    "template": "default",
    "title": "Sandbox Test",
    "subtitle": "First API Call",
    "fields": [
      { "label": "Name", "value": "John Doe" },
      { "label": "Email", "value": "john@example.com" }
    ],
    "footer": "Generated with OnPremPDF"
  }' \
  --output sandbox-test.pdf

The generated PDF is saved as sandbox-test.pdf.

Note: Depending on your shell or operating system (especially Windows), multiline JSON may not be parsed correctly by curl. If the request fails with 400 Invalid JSON, use the alternative below.


curl -X POST https://sandbox.onprempdf.com/pdfguard/api/v1/render -H "Content-Type: application/json" -d "{\"template\":\"default\",\"title\":\"Sandbox Test\",\"subtitle\":\"First API Call\",\"fields\":[{\"label\":\"Name\",\"value\":\"John Doe\"},{\"label\":\"Email\",\"value\":\"john@example.com\"}],\"footer\":\"Generated with OnPremPDF\"}" -o sandbox-test.pdf

The sandbox is publicly accessible and intended for evaluation purposes only.

API Endpoint

The endpoint synchronously generates a PDF document and returns it directly as the HTTP response.


POST http://{servername}:8080/pdfguard/api/v1/render
Content-Type: application/json

Request Body (JSON)

JSON structure sent in the body of the POST /api/v1/render request.

  • Each field represents one row in the PDF
  • Order is preserved
  • Dynamically extensible

Note: The fields array can contain an arbitrary number of entries. Each entry is rendered as a separate row in the generated PDF.

{
  "template": "default",
  "title": "Damage Report",
  "subtitle": "Date: 2026-01-10",
  "fields": [
    { "label": "Type", "value": "Water damage" },
    { "label": "Description", "value": "Water is leaking" },
    { "label": "Name", "value": "John Doe" },
   { "label": "E-Mail", "value": "john@example.de" }
  ],
  "footer": "Generated on 2026-01-11"
}

Request Parameters

All parameters are sent as JSON in the request body.

Parameter Type Description Default
template string PDF layout template to use for rendering
Example: "default", "invoice", "report"
default
title string Document title null
subtitle string Subtitle (e.g. date or reference) null
fields array List of label/value objects []
footer string Footer text null

Templates

Templates are customized per customer and provided and deployed by the OnPremPDF team.

PDF templates define the visual layout and structure of generated documents. A customer environment may contain one or multiple templates.

The template to be used can be selected via the optional template field in the request body. If the field is omitted, the default template is applied.

{
  "template": "default"
}

Custom template example

Below is an example of a customer-specific template. Custom templates may include complex layouts such as table-based documents, invoices, certificates, reports or government forms.

Code Examples

This example uses the sandbox URL. Please replace it with http://{servername}:8080/pdfguard/api/v1/render.


import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.charset.StandardCharsets;

public class Example {

  public static void main(String[] args) throws Exception {

    String json =
      "{"
    + "\"template\":\"default\","
    + "\"title\":\"Damage Report\","
    + "\"subtitle\":\"Date: 2026-01-10\","
    + "\"fields\":["
    + "  {\"label\":\"Name\",\"value\":\"John Doe\"},"
    + "  {\"label\":\"Email\",\"value\":\"john@example.com\"},"
    + "  {\"label\":\"Damage Type\",\"value\":\"Water damage\"}"
    + "],"
    + "\"footer\":\"Generated with OnPremPDF\""
    + "}";

    URL url = new URL("https://sandbox.onprempdf.com/pdfguard/api/v1/render");
    HttpURLConnection con = (HttpURLConnection) url.openConnection();

    con.setRequestMethod("POST");
    con.setRequestProperty("Content-Type", "application/json");
    con.setDoOutput(true);

    try (OutputStream os = con.getOutputStream()) {
      os.write(json.getBytes(StandardCharsets.UTF_8));
    }

    int status = con.getResponseCode();
    System.out.println("HTTP Status: " + status);

    if (status != 200) {
    throw new RuntimeException("HTTP error: " + status);
    }

    try (InputStream is = con.getInputStream()) {
      Files.copy(is, Path.of("document.pdf"), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
    }

    System.out.println("PDF generated successfully.");
  }

}

HTTP Responses & Error Messages

The API returns standardized HTTP status codes to indicate whether a PDF generation request was successful or not. Errors are communicated exclusively via HTTP status codes.

Successful Request


200 OK
Content-Type: application/json
    

The generated PDF document is returned directly in the response body.

Error Responses

HTTP Code Meaning Description
200 OK PDF generated successfully. The PDF document is returned directly in the HTTP response body.
400 Bad Request Invalid or unparsable JSON, or an incorrect Content-Type header.
422 Unprocessable Entity Required fields are missing (e.g. title or fields).
429 Too Many Requests The daily request limit of the API key or license has been reached.
500 Internal Server Error An unexpected internal error occurred during PDF generation.

If audit logging is enabled, every request is recorded in the audit logs with its status (SUCCESS, FAILED, or REJECgTED).

Administration Interface Admin GUI

The administration interface is used to monitor system status and manage the active license. It is installed locally together with the PDFGuard API and requires no external services.

  • PDF service status and runtime health
  • Installed version and operating mode
  • Active license type and limits
  • Local REST API endpoint information

Access to the administration interface requires authentication. The default administrator username is pdfguard. The password is generated during installation and is displayed once in the terminal output only.

The interface is available locally at:


http://{servername}:8080/pdfguard/
    
Credentials
Username: pdfguard Password: stored in /opt/tomcat/conf/tomcat-users.xml Permissions: 600 (readable only by the tomcat user; password is randomly generated )
Example: Administration interface
PDFGuard administration interface overview

Optional Sandbox Preview

For evaluation purposes only, a read-only example of the administration interface is available in the sandbox environment:

Open Sandbox Admin GUI

The sandbox is provided for preview purposes only and does not allow configuration changes or license activation.

Dashboard Monitoring

The dashboard provides a real-time overview of PDF generation activity based exclusively on local audit log data. It is designed for operational monitoring and compliance visibility.

  • Total PDF requests within the selected time range
  • Breakdown by request status (SUCCESS, REJECTED, FAILED)
  • Daily request volume visualization
  • Time-based filtering (e.g. last 7 or 30 days)

The dashboard is available locally at:


http://{servername}:8080/pdfguard/dashboard.html
    

All statistics are derived from local audit CSV files only. No external services, telemetry, or third-party analytics are used.

Example: System dashboard view
PDFGuard system dashboard overview

Audit Logs Compliance

The administration interface provides tamper-resistant audit logs to ensure traceability of all PDF generation requests. Audit logging is available depending on the active license.

  • Timestamp of the PDF generation (date and time)
  • Internal request ID (non-content, technical traceability only)
  • Backend rendering process time in ms
  • IP address of the calling system (anonymized / masked)
  • Status of the REST API request (SUCCESS, FAILED, REJECTED)

Audit logs are available locally at:


http://{servername}:8080/pdfguard/logs.html
    

No PDF content, request payload data, or personally identifiable information is stored or displayed in the audit logs.

Example: Audit log view
PDFGuard audit logs administration interface

Audit Retention

Defines how long audit logs are retained before automatic deletion.

  • Supports GDPR compliance
  • Prevents unlimited log storage
  • Automatic cleanup of older audit entries