Repository navigation
PDF thumbnail example: keep the thumbnail inside 300x300 - #123
Merged
Merged
Conversation
Without FitToSize, the ImageHeight=300 / ImageWidth=300 request came back 300x388 for the portrait test.pdf: the width was applied, the height was not. FitToSize fits the image inside both limits (231x300). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
Merged
Merged
Merged
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the example-only change that enables proportional thumbnail fitting within 300×300 pixels.
No open issues 🎉
What changed in this PR
Updates the PDF thumbnail example to fit the output within 300×300 pixels while preserving its aspect ratio. Library behavior is unchanged.
Changes:
- Adds
FitToSize: truealongside the existing width and height limits.
| File | Description |
|---|---|
examples/create_pdf_thumbnail.js |
Enables proportional fitting within both thumbnail size limits. |
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.
Problem
The example has made the thumbnail in one
pdf -> jpgcall since fd2449c. It asks forImageHeight300 andImageWidth300, but returns 300x388 for the portraittest.pdf: withoutFitToSizethe API applies the width, keeps the aspect ratio and lets the height grow.Change
FitToSize: truefits the image inside both limits: 231x300. The PHP, Python, Ruby, Java and .NET thumbnail examples now produce the same file.Verification
Run from the repository root after
npm ci && npm run build, Node v24.20.0, production API, 2026-11-06.$TMPDIRis the local temp folder:test.jpg: 300x388 px, 13,317 bytes.test.jpg: 231x300 px, 8,858 bytes.CI runs the examples against staging, whose
pdf -> jpgalso hasFitToSize(spec).Only the example changes, not the library, so there is no CHANGELOG entry.
The thumbnail examples of the other SDKs are fixed in ConvertAPI/convertapi-library-python#61, ConvertAPI/convertapi-library-php#72, ConvertAPI/convertapi-library-ruby#42, ConvertAPI/convertapi-library-java#56, ConvertAPI/convertapi-library-dotnet#82.
🤖 Generated with Claude Code