Skip to content
Lamina PDF
0.9.0
GitHub
Open the web app

imagesToPdf

function imagesToPdf(images, options?): Document;

Defined in: packages/sdk/src/builder.ts:1285

A new document with one page per image, in order. Needs the extract or the text module (loadExtract(), or init({ text: true })). A JPEG is embedded as it is, without decoding it; a PNG keeps its transparency; each image is drawn the way up its EXIF orientation says.

readonly Image[]

the pages’ images, at least one.

ImagesToPdfOptions = {}

the page size to fit them in, the margin, the default resolution, and the file ID, producer and creation date.

Document

using doc = imagesToPdf([Image.jpeg(photo)], { fit: "A4", margin: 42 });
const pdf = doc.save();

LaminaPdfError not-initialized; extract-module-not-loaded when neither the extract nor the text module is loaded; invalid-geometry for no images, a negative margin or resolution, or a page too small for its margins; unknown-option, invalid-argument.

0.3.0