Skip to content

PDF thumbnail example: fix the comment, keep the thumbnail inside 300x300 - #82

Merged
tomasr78 merged 1 commit into
mainfrom
fix-pdf-thumbnail-example
Nov 9, 2026
Merged

tomasr78 merged 1 commit into
mainfrom
fix-pdf-thumbnail-example

Conversation

@tomasr78

@tomasr78 tomasr78 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The example already makes the thumbnail in one pdf -> jpg call, but:

  • its comment still described the old chain ("extracting first page from PDF and then converting it to JPG using chaining") and linked https://www.convertapi.com/pdf-to-extract. pdf -> extract is now the AI data-extraction converter (spec).
  • ScaleImage and ScaleProportions are not pdf -> jpg parameters (spec) and the API ignores them. The 300x300 request came back 300x388 for test.pdf (US Letter), byte for byte the same as without them.

Change

  • The comment describes and links only https://www.convertapi.com/pdf-to-jpg.
  • ScaleImage and ScaleProportions are dropped. FitToSize keeps the thumbnail inside 300x300 with its aspect ratio: 231x300.

Verification

dotnet build Examples/CreatePdfThumbnail/CreatePdfThumbnail.csproj: build succeeded, 0 warnings.

The example hard-codes "api_token" and a Windows relative path, so I ran a copy of this Program.cs with only those two lines changed: the token from an environment variable and an absolute path to Examples/TestFiles/test.pdf. .NET SDK 10.0.401, production API, 2026-11-06. $TMPDIR is the local temp folder:

$ dotnet run
The thumbnail saved to $TMPDIR/test.jpg

test.jpg is 231x300 px, 8,858 bytes.

Seen while running it, not changed here: the examples reach TestFiles with either ..\..\..\ or ..\..\..\..\, and this one uses three levels. From the build output folder bin\Debug\net10.0, only the four-level form reaches Examples\TestFiles.

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-node#123.

🤖 Generated with Claude Code

…x300

The example already converts page 1 straight to JPG, but its comment
still described the old extract-then-convert chain and linked
pdf-to-extract, which is now the AI data-extraction converter.

ScaleImage and ScaleProportions are not pdf -> jpg parameters and the API
ignored them, so the 300x300 request came back 300x388 for test.pdf.
FitToSize keeps the thumbnail inside 300x300 (231x300).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the PDF thumbnail example’s sizing and documentation updates.

No open issues 🎉

What changed in this PR

Updates the PDF thumbnail example to use supported sizing parameters and accurately describe its direct PDF-to-JPG conversion.

Changes:

  • Replaces unsupported ScaleImage and ScaleProportions parameters with FitToSize to preserve aspect ratio within 300×300 pixels.
  • Corrects the comment and removes the obsolete PDF extraction link.
File Description
Examples/​CreatePdfThumbnail/​Program.cs Corrects the conversion comment and updates thumbnail sizing parameters.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants