Skip to content

Graphics

graphics : object

PostalPoint uses the Jimp library version 1.6 for creating and manipulating images and shipping labels.

Kind: global namespace

graphics.Jimp() ⇒ Jimp

The JavaScript Image Manipulation Program.

Kind: static method of graphics
Example

const {Jimp} = global.apis.graphics.Jimp();

graphics.loadFont(filename) ⇒ Promise

Replacement for Jimp's loadFont function, which gets very confused about our JS environment and ends up crashing everything.

Kind: static method of graphics

Param Type
filename string

graphics.pdfToImage(buffer, width, height, [autoRotate], [outputPageCount]) ⇒ Array

Convert a PDF to an array of images with the specified width and height. Pages that aren't the same ratio as the specified width and height will be centered on the image.

Kind: static method of graphics
Returns: Array - Jimp image array, one image per page

Param Type Default Description
buffer Buffer PDF data as Buffer
width Number Desired output width in pixels
height Number Desired output height in pixels
[autoRotate] Boolean true If true, images will be rotated to best fit the desired dimensions.
[outputPageCount] Number -1 Only process the first N pages, or all if -1.