From 3ccfb6ed240a32d2bd9f267583ccf6c37a37b0cf Mon Sep 17 00:00:00 2001 From: Tomas Rutkauskas Date: Mon, 9 Nov 2026 15:46:13 +0200 Subject: [PATCH] examples: use the converters the API spec documents The production API spec (https://v2.convertapi.com/info/openapi) has no web -> pdf and no jpg -> zip converter. ConvertWebToPdf now converts the URL with html -> pdf (same url and filename parameters) and links the html-to-pdf page. ConversionChaining zips the JPG results with file -> zip (same files parameter). Co-Authored-By: Claude Opus 5.5 --- .../main/java/com/convertapi/examples/ConversionChaining.java | 2 +- .../main/java/com/convertapi/examples/ConvertWebToPdf.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java index 53ff39c..2dbd95c 100644 --- a/examples/src/main/java/com/convertapi/examples/ConversionChaining.java +++ b/examples/src/main/java/com/convertapi/examples/ConversionChaining.java @@ -27,7 +27,7 @@ public static void main(String[] args) throws IOException, ExecutionException, I CompletableFuture jpgResult = ConvertApi.convert("docx", "jpg", new Param("file", Paths.get("files/test.docx"))); System.out.println("ConvertApi.convert is not blocking method, proceeding to ZIP conversion"); - CompletableFuture zipResult = ConvertApi.convert("jpg", "zip", new Param("files", jpgResult)); + CompletableFuture zipResult = ConvertApi.convert("file", "zip", new Param("files", jpgResult)); System.out.println("Saving result file (blocking operation)"); Path tempDir = Paths.get(System.getProperty("java.io.tmpdir")); diff --git a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java index 6bdaa81..bd77d4e 100644 --- a/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java +++ b/examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java @@ -15,7 +15,7 @@ /** * Example of converting Web Page URL to PDF file - * https://www.convertapi.com/web-to-pdf + * https://www.convertapi.com/html-to-pdf */ public class ConvertWebToPdf { @@ -23,7 +23,7 @@ public static void main(String[] args) throws ExecutionException, InterruptedExc Config.setDefaultApiCredentials(getenv("API_TOKEN")); // Get your api token at https://www.convertapi.com/a/authentication System.out.println("Converting WEB to PDF"); - CompletableFuture result = ConvertApi.convert("web", "pdf", + CompletableFuture result = ConvertApi.convert("html", "pdf", new Param("url", "https://en.wikipedia.org/wiki/Data_conversion"), new Param("filename", "web-example") );