The Code Codex
Theme

Images to PDF

Convert photos and images (PNG, JPG, WebP, GIF, BMP, SVG) into a single PDF document with page size, orientation, and margin controls.

The link keeps what is on screen.
Parameters
Page setup
Paper size
Orientation
Image fit
Page background
PDF metadata
Selected imagesDrop images (PNG, JPG, WebP, GIF, BMP, SVG) or click to add
How is it calculated?
PNG and JPEG images are embedded directly as PDF XObjects via pdf-lib. Other browser-supported formats (WebP, GIF, BMP, SVG) are converted locally on an offscreen <canvas> before building the document. Pages are sized in typographic points (1 pt = 1/72 in).
See the code ↗

Processed in your browser; nothing is sent.

⌨️ Use from the terminal (PDF)

This tool also runs outside the site: the cli.js script renders the invoice PDF in the terminal, from the same JSON as this page's share link. Use format=json to get just the data and totals.

Deno
deno run -q "https://thecodecodex.com/cli.js?tool=image-to-pdf" > image-to-pdf.pdf
Node.js / Bun
curl -s https://thecodecodex.com/cli.js | node --input-type=module - image-to-pdf > image-to-pdf.pdf size=…
ParameterDescriptionDefault
sizea4 | letter | legal | fita4
orientauto | portrait | landscapeauto
fitcontain | cover | stretchcontain
marginmargem em pt (0-144)24
bgwhite | black | transparentwhite
titletítulo do PDF—
authorautor do PDF—
inimagens PNG/JPEG em Base64 separadas por vírgula (vazio = imagens de exemplo)exemplo
formatpdf | jsonpdf

Requires Deno, Node.js or Bun. With Deno the script runs with no permissions: it cannot read files or access the network. Central Bank indicators are from the day the site was published.

More in Documents & PDF