Make matching thumbnail tiles from a cropped PDF
Admin ·
Make small page previews for a gallery or document picker. Compare the page-shaped PNGs with uniform tiles when the PDF mixes portrait and landscape pages.
Compare thumbnails at a 320 pixel longest edge
Select Load example to open Harbor Postcard. Keep both pages selected, set Thumbnail sizing to Longest edge, and use 320 pixels. Generate thumbnails. The cropped first page is wider than it is tall, while the rotated second page is taller.
The first preview is 320 × 213 px and the second is 213 × 320 px. The longest side is exact. The other side rounds to the nearest pixel.
Download the two-page Harbor Postcard PDFMozilla PDF.js page viewport and render examples
Fit both pages inside 320 × 240 pixel tiles
Change Thumbnail sizing to Fixed tile and keep width 320 and height 240. Keep the light green padding color or set your own. Generate thumbnails again.
Page 1 fills the width with narrow bands above and below. Page 2 fits as a 160 × 240 px portrait, with 80 px of padding on each side. Both saved PNGs are 320 × 240 px.
| Source page | Longest edge mode | Fixed tile mode |
|---|---|---|
| 1 | 320 × 213 px | 320 × 240 px |
| 2 | 213 × 320 px | 320 × 240 px |
Download the two-page Harbor Postcard PDFMozilla PDF.js page viewport and render examplesWHATWG Canvas image serialization and PNG encoding
Check the PNGs inside the ZIP
Download the thumbnail ZIP and reopen page-001.png and page-002.png. Check the image dimensions in an image viewer and confirm the crop, rotation and padding. Turn off Fixed tile and regenerate if the images should follow the individual page shapes.
To export only the second page, enter 2 in Pages to thumbnail and generate again. Its name remains page-002.png because the filename follows the source page position.
Download the two-page Harbor Postcard PDFWHATWG Canvas image serialization and PNG encoding
Common questions
Does the padding color replace the page background?
The padding fills the space outside the fitted page. The visible PDF page itself renders over white.
Can I use the PNGs as editable PDF pages?
The result is a bitmap preview. Use the original PDF for selectable text, links or further page editing.