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.
Parameters
Section titled “Parameters”images
Section titled “images”readonly Image[]
the pages’ images, at least one.
options?
Section titled “options?”ImagesToPdfOptions = {}
the page size to fit them in, the margin, the default resolution, and the file ID, producer and creation date.
Returns
Section titled “Returns”Example
Section titled “Example”using doc = imagesToPdf([Image.jpeg(photo)], { fit: "A4", margin: 42 });const pdf = doc.save();Throws
Section titled “Throws”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