File & PDF Tools

Images to PDF

Build a PDF from multiple images in a custom order.

Images to PDF
Create one page per image with configurable page fitting.
Local processing

Images to PDF

Write browser-readable images to a PDF in list order, with one image per page.

Page Options

  • Match image, A4, or Letter size
  • Contain the full image or cover and crop
  • Configure orientation and margins

Converts a list of browser-decodable images into one PDF with a single image per page, assembled by pdf-lib inside the tab. Each page can follow its own image box or snap to A4 or Letter, with contain or cover fitting, orientation, and margins from 0 to 300 pt. Fits photographed forms, whiteboard shots, and slide exports that must ship as one file.

Every image is re-encoded to PNG before it reaches the PDF

Nothing is passed through untouched. Each file is decoded to pixels by createImageBitmap, with an HTMLImageElement fallback, drawn onto a canvas at natural size, and serialised through the canvas toBlob call with image/png. pdf-lib then loads that PNG, discards its IDAT data, and writes the raw 8-bit RGB samples back out as a /FlateDecode image XObject; an alpha channel becomes a separate DeviceGray /SMask, so transparency survives while an animated GIF keeps only its first frame. Flate is a general-purpose codec, not a photographic one: a 1200 × 1600 test photo at JPEG quality 85 weighs 415 KB, yet as RGB Flate it needs about 4.9 MB, roughly 2.6 bytes per pixel. That ratio is why a few megabytes of phone JPEGs can produce a PDF an order of magnitude larger.

Page size, the 0.75 factor, and where contain and cover land

PDF user space is measured in points, where 1 pt = 1/72 inch. A4 is 595.28 × 841.89 pt (210 × 297 mm) and Letter is 612 × 792 pt (8.5 × 11 in). In match-image mode the page box is image pixels × 0.75 plus twice the margin, because browsers report CSS pixels at 96 per inch and 72 / 96 = 0.75: the image lands at exactly 96 dpi. Contain scales by min(available width / image width, available height / image height) and centres the drawing; cover takes the max instead, so the drawing rectangle overflows the MediaBox and the page box clips it at render and print time while the full-resolution pixels stay in the file. Orientation auto keeps the computed box; portrait or landscape swaps the two numbers whenever they disagree.

What the output PDF does and does not contain

One page per listed file, in list order, each holding a single image XObject placed by a transformation matrix. No text object is ever written, so there is no extractable text layer and no OCR pass: searching the result for a word visible in the photographed page returns nothing. The document is saved as PDF 1.7 with object streams enabled, so dictionaries are packed into /ObjStm entries behind a cross-reference stream. pdf-lib stamps /Producer with its GitHub URL plus /CreationDate and /ModDate; there is no title, author, outline, tagged structure, or /Rotate, because orientation is already baked into the pixels. The same file listed twice becomes two independent XObjects, so nothing is deduplicated.

Worked example

A 1200 × 1600 phone photo with match-image and a 24 pt margin

Input
scan-01.jpg — 1200 × 1600 px; page size Match image, orientation Auto, fit Contain, margin 24 pt
Output
images.pdf — 1 page, MediaBox 948 × 1248 pt, image drawn 900 × 1200 pt at x = 24, y = 24

1200 × 0.75 = 900 pt and 1600 × 0.75 = 1200 pt, plus 24 pt on each side, gives 948 × 1248. The available area is therefore exactly 900 × 1200, so contain resolves to scale 0.75 and the drawing rectangle touches all four margins with no leftover padding.

Limits and pitfalls

  • The selection must total 250 MB or less, re-checked before encoding, and any single image above 40,000,000 pixels is rejected — an 8000 × 5000 panorama already exceeds it.
  • Margin accepts 0 to 300 pt, but the tool aborts if the margin leaves less than 1 pt of drawable area, so on the 595.28 pt width of A4 the per-side ceiling is 297.14 pt.
  • The download is always named images.pdf, so repeat runs pile up as images (1).pdf, images (2).pdf; each run rebuilds the document in memory rather than appending to an existing file.
  • Images are never downsampled: a 4000 px wide photo stays 4000 px wide inside an A4 page that needs only about 2480 px for 300 dpi printing, so output size tracks camera resolution rather than paper size.
  • Cover fitting crops visually but keeps the whole image in the file, so switching from contain to cover never shrinks the download.

Related tools

When it goes wrong

I picked a second batch of images and the first ten disappeared from the list.

CauseThe dropzone hands its whole selection to one handler that assigns the array outright, so a new pick replaces the current set rather than appending to it, and it also discards any PDF already built from the old list.

FixChoose every page in a single dialog with Shift or Cmd click, then set the page order with the up and down arrows; a second selection starts a new list.

Photos straight off my phone fail with a decode error while older JPGs go through.

CauseThe type gate accepts any file whose MIME type starts with image/, so an iPhone .heic file is allowed in, but Chrome and Firefox can neither decode it through createImageBitmap nor through the HTMLImageElement fallback. The extension whitelist behind the gate lists only avif, bmp, gif, jpg, png and webp.

FixExport as JPEG before loading, for example sips -s format jpeg IMG_0042.heic --out scan.jpg, then rebuild the list.

I changed page size to A4, clicked Download again, and still got the oversized pages.

CausePage size, orientation, fit and margin hold no watcher. A document is only rebuilt when Create PDF is pressed, and only file-list edits (add, reorder, remove) throw away the stored blob; Download just re-serves the blob made with the previous settings.

FixPress Create PDF again after touching any of the four selects or the margin box, then download the fresh result.

Setting the margin to 300 pt only added white space, the picture stayed the same size.

CauseOn Match image the MediaBox is pixel size times 0.75 plus twice the margin, so the box grows exactly as much as the margin does and the image is then fitted to the reduced area at an unchanged 0.75 scale, unless the 72 pt minimum page clamps the box.

FixChoose A4 or Letter when the margin has to eat into the image, and leave Match image at a margin of 0 when you only want a white border trimmed.

Half of my slide went missing after I switched to Cover and crop.

CauseCover scales by the larger of the two ratios, so a 16:9 image on A4 gets a drawing rectangle wider than the MediaBox; the surplus pixels stay in the file but the viewer and the printer clip them, with no preview or warning.

FixUse Contain for anything that must be read in full, or return to Match image, where the page takes the image aspect and both scales come out equal, so nothing is cut.

One concrete scenario

Twelve phone scans that have to print on A4

Twelve scans at 4032 × 3024 px each become twelve pages. Left on Match image with the default 24 pt margin, every MediaBox is 3072 × 2316 pt, a sheet of roughly 108 × 82 cm with the pixels drawn at 96 dpi. Switch page size to A4 and orientation to Landscape and the box is fixed at 841.89 × 595.28 pt; the 24 pt margin leaves 793.89 × 547.28 pt, where contain scales the 4:3 image to 729.71 × 547.28 pt, about 398 dpi and still above the 300 dpi a print shop asks for. The 64 pt left over on the width is split 32 pt a side. Take A4 landscape for this set; keep Match image only when every scan has its own aspect ratio.

Frequently Asked Questions

Can I reorder pages after combining?
Yes — reorder, add, or remove in the list before generating. The standard scan workflow: photograph pages → import once → drag into order → generate the PDF.
Match image size or use A4?
Choose A4/Letter for printing and sharing (uniform paper); choose match-image for screen reading and archiving (no white borders, no scaling, full sharpness). Mixed-size scans look tidier unified to A4.
The PDF is huge — how do I shrink it?
The PDF embeds the original images losslessly, so size ≈ sum of images. Compress each image first (with the image compressor) or convert to JPEG around quality 80. A 300-dpi scan bundle landing at tens of MB is normal.

Content reviewed: