0.0.1 • Published 6 years ago
node-images2pdf v0.0.1
node-images2pdf
Package multiple images into a single PDF.
Installation
npm install --save node-images2pdf
Usage
Initialization
const Converter = require('node-images2pdf');
const pdf = new Converter(options);
Options
Name | Description | Type | Default | Optional |
---|---|---|---|---|
column | Number of images per column | number | false | |
row | Number of images per row | number | false | |
margin | Margin around the page in pixels | number | 72 | true |
minPaddingX | Minimum padding between images on the horizontal plane | number | 36 | true |
minPaddingY | Minimum padding between images on the vertical plane | number | 36 | true |
page.pageSize | Page size (Refer to this guide) | string | letter | true |
page.layout | Page layout | portrait , landscape | portrait | true |
image.imgSize | Auto image sizing options | fit | fit , stretch | true |
Methods
convert([images], output)
Given an array of image paths and the output path this function will generate a PDF output and return a Promise.
Example
const Converter = require('node-images2pdf');
const pdf = new Converter({column: 2, row: 3, margin: 0, page: {pageSize: 'A4'}, image: {imgSize: 'stretch'});
pdf.convert(['./images/img1.png', './images/img1.jpg', './images/img2.png', './images/img3.png', './images/img4.jpg'], './output.pdf')
.then(console.log)
.catch(console.error);
License
0.0.1
6 years ago