Skip to Content

Java

Official Java SDK for TemplateFox.

Maven Central GitHub Repository 

Installation

Maven

<dependency> <groupId>io.github.templatefoxpdf</groupId> <artifactId>sdk</artifactId> <version>1.0.0</version> </dependency>

Gradle

implementation 'io.github.templatefoxpdf:sdk:1.0.0'

Generate a PDF

import com.templatefox.sdk.ApiClient; import com.templatefox.sdk.api.PDFApi; import com.templatefox.sdk.model.CreatePdfRequest; public class Example { public static void main(String[] args) { // Initialize the client ApiClient client = new ApiClient(); client.setApiKey("your-api-key"); PDFApi api = new PDFApi(client); // Generate a PDF CreatePdfRequest request = new CreatePdfRequest() .templateId("YOUR_TEMPLATE_ID") .putDataItem("name", "John Doe") .putDataItem("invoice_number", "INV-001") .putDataItem("total_amount", 150.00); try { var response = api.createPdf(request); System.out.println("PDF URL: " + response.getUrl()); System.out.println("Credits remaining: " + response.getCreditsRemaining()); } catch (Exception e) { e.printStackTrace(); } } }

Configuration

ApiClient client = new ApiClient(); client.setApiKey(System.getenv("TEMPLATEFOX_API_KEY"));

Full SDK Reference

For the complete API coverage including templates, account, S3 integration, and error handling, see the GitHub repository README .

Last updated on