What Actually Happens When a Photo Becomes a PDF Page
Sending a photo as a PDF is one of those actions that feels like a single step and is actually four. The image is decoded, possibly downscaled, scaled into a page box, and re-encoded into a stream that a PDF reader can draw. Each of those steps has a number attached, and the numbers explain almost every complaint people have about the result: the white bands, the soft print, the file that cannot be searched.
This page walks through the implementation of our own Image to PDF tool. It is not a list of tips; it is the geometry, with worked examples you can check on a calculator. The same reasoning applies to any image-to-PDF converter, because PDF pages are measured in the same units everywhere.
Two page sizes, two intentions
PDF does not measure pages in pixels or millimetres. It measures them in points, where one point is 1/72 inch. A4 is 210 × 297 mm, which converts to 210 / 25.4 × 72 = 595.28 points wide and 297 / 25.4 × 72 = 841.89 points tall. The control on our page says "A4 (595 × 842)" because the labels are rounded; the numbers written into the file are 595.28 and 841.89.
The second option, Match image size, does something different. It takes the first image in the list, multiplies its pixel dimensions by 0.75, and uses the result as the page box. That factor is not arbitrary: a CSS pixel is defined as 1/96 inch, and 72/96 = 0.75. In other words, this mode reproduces the image at the size a browser would show it at 100% zoom, then declares the page to be exactly that size.
| Source image | A4 page | Match image size page |
|---|---|---|
| 1200 × 800 px | 595.28 × 841.89 pt (portrait, fixed) | 900 × 600 pt = 317.5 × 211.7 mm |
| 2000 × 3000 px | 595.28 × 841.89 pt | 1500 × 2250 pt = 529 × 794 mm |
| 800 × 800 px | 595.28 × 841.89 pt | 600 × 600 pt = 211.7 × 211.7 mm |
Notice what the middle column does not do: it never changes orientation. A landscape photo on A4 gets a landscape-shaped picture inside a portrait page, with generous top and bottom margins. If you want the page itself to be landscape, "Match image size" is the mode that gets you there — a 2000 × 3000 pixel page becomes 529 × 794 mm, which most printers will then shrink to fit their paper. That is fine for archiving and wrong for a print job that must land at a specific size.
The fit rule, and the margins it creates
The placement is one line of arithmetic. The tool computes a single scale factor for both axes:
s = min(pageWidth / imageWidth, pageHeight / imageHeight)
dw = imageWidth * s
dh = imageHeight * s
dx = (pageWidth - dw) / 2
dy = (pageHeight - dh) / 2
Because the same s is used on both axes, the aspect ratio never changes. Because it is the minimum of the two ratios, the image always fits entirely inside the page — nothing is cropped. The leftover space is split evenly around the image, which is why the result looks centred.
Those two properties explain the white bands. Take a 2000 × 1500 landscape photo on A4:
s = min(595.28 / 2000, 841.89 / 1500) = min(0.2976, 0.5613) = 0.2976- drawn size: 595.28 × 446.46 pt — the width is fully used
- vertical margin:
(841.89 − 446.46) / 2 = 197.7 pt, about 69.8 mm at the top and the same at the bottom
A portrait photo of 1500 × 2000 behaves differently because the limiting dimension changes: s = min(0.3969, 0.4209) = 0.3969, the image becomes 595.28 × 793.7 pt, and the margins shrink to 24.1 pt (8.5 mm). A square 2000 × 2000 image leaves 123.3 pt (43.5 mm) top and bottom. The margins are not a setting; they are the consequence of fitting a 3:2 or 1:1 rectangle into a 1:1.414 page.
The 2000-pixel ceiling
Before any of that geometry happens, each image is downscaled so its longest side is at most 2000 pixels. A 4032 × 3024 phone photo becomes 2000 × 1500. The reason is practical: the PDF stores a JPEG per page, and a 12-megapixel JPEG at quality 85 can exceed 3 MB on its own, which makes a ten-page document unpleasant to email.
The consequence is a hard ceiling on print resolution, and it is easy to calculate. Pixels per inch is simply pixels divided by inches of paper:
| Placement on A4 | Pixels used | Paper dimension | Effective resolution |
|---|---|---|---|
| Landscape photo, full width | 2000 px | 210 mm = 8.268 in | 241.9 dpi |
| Portrait photo, full height | 2000 px | 297 mm = 11.693 in | 171.0 dpi |
| Square photo, fitted | 2000 px | 210 mm = 8.268 in | 241.9 dpi |
| 300 dpi full A4 (reference) | 2480 × 3508 px | 210 × 297 mm | 300 dpi |
Read the second row carefully, because it is the one that surprises people. A portrait photo is limited by the page height, and 2000 pixels spread across 297 mm is 171 dpi — noticeably below the 300 dpi usually quoted for print. The same 2000 pixels across the shorter 210 mm dimension give 242 dpi, which is acceptable for most home and office printing. So the honest summary is: this tool is comfortable at roughly 170–242 dpi on A4, not at 300 dpi.
If a print shop asks for 300 dpi at A4, no setting in the converter will produce it, because the pixels are discarded before the page is built. The workaround is to split the job: keep the original file for print, and use the PDF for proofing, email and archives. Our resolution and DPI guide covers the arithmetic for other paper sizes.
What the page really contains
Each page object holds one image XObject. The image data is a baseline JPEG, written with the /DCTDecode filter, and drawn onto the page by a single transformation matrix. The sharpness control on the page is the JPEG quality, defaulting to 85. That has three consequences worth knowing before you send the file to anyone.
One lossy generation is added
JPEG is lossy. If the source was already a JPEG, the PDF contains a re-encode of a re-encode. At quality 85 the second generation is usually hard to see at normal viewing size, but it is measurable on sharp text and thin lines. If the source is a PNG screenshot with small type, converting it to JPEG inside the PDF will soften the glyph edges; a PNG source with large photographic content suffers much less.
Transparency becomes white
JPEG has no alpha channel. Before encoding, the tool scans the image for pixels with alpha below 250; if it finds any, it composites the image onto a white canvas. A transparent logo therefore arrives as a logo on a white rectangle. That is the right default for a document, and the wrong result if you expected the page background to show through.
The text is not text
Nothing in the pipeline recognises characters. The PDF has no font objects for your content, no text layer and no OCR. Search, copy-paste, text reflow and screen readers will all find an empty page. If the document needs to be searchable, it has to be produced from text, or run through OCR afterwards — that is a different job from converting pictures.
Page order is the only editorial control
Multi-select is allowed, and the list can be reordered with the up and down arrows before generating; the cross removes an item. The order of that list is the order of pages in the file. There is no automatic sorting by filename, date or size, so a batch of scans selected in the wrong order stays wrong.
Two practical notes. First, a mixed batch is allowed — one page can be a 4000-pixel photo and the next a 900-pixel screenshot; each is scaled independently, so the small one will look softer but nothing breaks. Second, all pages share one page size, taken from the mode you chose, and in "Match image size" mode the box is derived from the first image only. If that first image is a small one, every later page inherits a small box and large photos will be scaled down to fit inside it.
What this tool does not do
Being explicit about the boundaries saves a wasted round trip:
- No crops or rotation. The page is built from the pixels as they arrive. Rotate first if a scan is sideways.
- No page numbers, headers or watermarks. Those need a layout engine, not an image embedder.
- No per-page quality. One sharpness value applies to every page in the document.
- No encryption or permissions. The output is a plain PDF 1.4 file with no password support.
- No size estimate until generation finishes. The file is assembled in memory and the total is reported afterwards.
Choosing between the two modes
The decision is about what happens after the file leaves your browser.
| Goal | Mode | Why |
|---|---|---|
| Print on A4, forms, letters | A4 | The page equals the paper; the printer does not rescale. |
| Email a set of photos | A4 | Predictable page count, consistent margins, smaller total size. |
| Archive an image at its own proportions | Match image size | The page box follows the picture, so nothing is padded. |
| Hand to a designer | Match image size | Page dimensions encode the intended physical size. |
| Full-bleed A4 poster | A4, after cropping to 1:1.414 | Fitting cannot remove margins; cropping does. |
One last check before you send anything to a printer: open the PDF, zoom to 100%, and look at the thinnest line in the image. If it has become a soft grey smear, the JPEG generation is the cause, and re-generating from a PNG source at the same quality is the cheapest fix.
Frequently asked questions
| Why is there a white border? | The image is fitted, not stretched. Its aspect ratio rarely equals A4's, so the difference becomes margin. Crop to 1:1.414 to remove it. |
|---|---|
| Why is my 12 MP photo only 2000 px in the PDF? | Every page is capped at 2000 px on the long side to keep the file emailable. The cap is applied before the page box is calculated. |
| Can I get 300 dpi? | Not on A4 at this cap. 300 dpi A4 requires 2480 × 3508 px; the tool stops at 2000 px, which works out to about 171–242 dpi depending on the fit. |
| Is the result searchable? | No. The page is a picture. Use a text-based workflow or OCR if you need selectable text. |
| Does it upload my files? | No. Decoding, scaling, JPEG encoding and PDF assembly all run in the browser tab; the file never leaves the device. |
Try it on your own file
Open Image to PDF, load a photo, and compare A4 with Match image size side by side. The page count and the total size are shown before you download.
Related reading
- Compressing to a target KB — why width caps beat quality sliders when a form demands 200 KB.
- Resolution and DPI — the pixel-per-inch arithmetic for other paper sizes.
- Choosing an image format — when PNG is worth the extra bytes inside a document.
- What survives in your image metadata — the fields a re-encode keeps and drops.