From df41b05cab64009ae46084146afe8e2894604974 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 any -> zip converter. convert_url_to_pdf.js and get_result_file_stream.js now convert the URL with html -> pdf (same Url and FileName parameters) and link the html-to-pdf page. conversion_chaining.js passes 'file' as the source format of the ZIP step: without a source format the library sends every zip conversion to any -> zip. Co-Authored-By: Claude Opus 5.5 --- examples/conversion_chaining.js | 2 +- examples/convert_url_to_pdf.js | 4 ++-- examples/get_result_file_stream.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/conversion_chaining.js b/examples/conversion_chaining.js index 78140e6..00c0ac9 100644 --- a/examples/conversion_chaining.js +++ b/examples/conversion_chaining.js @@ -12,7 +12,7 @@ console.log("Converting PDF to JPG and compressing result files with ZIP\n"); convertapi.convert('jpg', { File: './examples/files/test.pdf' }) .then(function(jpgResult) { - return convertapi.convert('zip', { Files: jpgResult }); + return convertapi.convert('zip', { Files: jpgResult }, 'file'); }) .then(function(zipResult) { return zipResult.saveFiles(dir); diff --git a/examples/convert_url_to_pdf.js b/examples/convert_url_to_pdf.js index 1610c94..668084c 100644 --- a/examples/convert_url_to_pdf.js +++ b/examples/convert_url_to_pdf.js @@ -4,10 +4,10 @@ var convertapi = require('../lib')(process.env.API_TOKEN); // Example of converting Web Page URL to PDF file -// https://www.convertapi.com/web-to-pdf +// https://www.convertapi.com/html-to-pdf var dir = require('os').tmpdir(); -var fromFormat = 'web'; +var fromFormat = 'html'; var conversionTimeout = 180; var params = { diff --git a/examples/get_result_file_stream.js b/examples/get_result_file_stream.js index 5a47833..e1b7062 100644 --- a/examples/get_result_file_stream.js +++ b/examples/get_result_file_stream.js @@ -4,9 +4,9 @@ var convertapi = require('../lib')(process.env.API_TOKEN); // Example of converting Web Page URL to PDF and reading file data as string -// https://www.convertapi.com/web-to-pdf +// https://www.convertapi.com/html-to-pdf -var fromFormat = 'web'; +var fromFormat = 'html'; var conversionTimeout = 180; var https = require('https'); var Stream = require('stream').Transform;