Repository navigation
Examples: use the converters the API spec documents - #58
Merged
Merged
Conversation
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 <noreply@anthropic.com>
This was referenced Nov 9, 2026
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the two example converter updates.
No open issues 🎉
What changed in this PR
Updates two Java examples to use documented ConvertAPI converters without changing their parameters or the library implementation.
Changes:
- Switches web-page conversion from
web → pdftohtml → pdfand updates the documentation link. - Switches the ZIP step in the conversion chain from
jpg → ziptofile → zip.
| File | Description |
|---|---|
examples/src/main/java/com/convertapi/examples/ConvertWebToPdf.java |
Uses html → pdf and links to its documentation. |
examples/src/main/java/com/convertapi/examples/ConversionChaining.java |
Uses file → zip to archive the generated JPG files. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two examples call converters that the production API spec (https://v2.convertapi.com/info/openapi, 332 paths on 2026-11-09) does not list. Both still convert today, but developers copy these examples and the how-to guides on convertapi.com reuse them, so they should call documented converters. This is the Java part of what ConvertAPI/convertapi-library-dotnet#86 does for .NET.
ConvertWebToPdf.javaweb -> pdf, comment links /web-to-pdfhtml -> pdf(parameters), sameurlandfilename; comment links https://www.convertapi.com/html-to-pdfConversionChaining.javajpg -> zipfile -> zip(parameters), samefilesparameterhttps://www.convertapi.com/web-to-pdf is not in the site's sitemap; https://www.convertapi.com/html-to-pdf is. The other examples already call documented converters; the
pdf -> extractstep of CreatePdfThumbnail goes away with #56.Verified against production (2026-11-09)
OpenJDK 27.0.1 with convertapi 2.13.1 (the version
examples/pom.xmluses):./mvnw -f examples/pom.xml compilepasses. Each example ran from a folder holdingfiles/test.docx, once onmain(f74854f) and once on this branch, with the token inAPI_TOKEN(<tmp>isjava.io.tmpdir).ConversionChaining, same output before and after:
Both runs saved a 711,617-byte
test.zipwithtest.jpgandtest-2.jpg; the JPGs are byte-identical before and after.ConvertWebToPdf, same output before and after:
The PDF text: on
mainand in both runs on this branch, Wikimedia answered ConvertAPI's renderer with its "Too many requests" page (1 page, 62 words), the same page the oldweb -> pdfgot. This does not depend on the converter: in the same hour the samehtml -> pdfcall rendered the article (3 pages, 1,925 words) from the Go, Python, PHP and Ruby examples. The demo URL is being looked at separately.Seen, not changed: ConversionChaining's comment and first message say it converts a PDF, but it converts
files/test.docx.Same change in the other SDKs
🤖 Generated with Claude Code