0.0.1 • Published 6 years ago

node-images2pdf v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

NameDescriptionTypeDefaultOptional
columnNumber of images per columnnumberfalse
rowNumber of images per rownumberfalse
marginMargin around the page in pixelsnumber72true
minPaddingXMinimum padding between images on the horizontal planenumber36true
minPaddingYMinimum padding between images on the vertical planenumber36true
page.pageSizePage size (Refer to this guide)stringlettertrue
page.layoutPage layoutportrait, landscapeportraittrue
image.imgSizeAuto image sizing optionsfitfit, stretchtrue

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

MIT