pdf-to-png-converter
Node.js utility to convert PDF file/buffer pages to PNG files/buffers without binary and OS dependencies (except macOS on arm64).
Getting Started
Package Installation
Installation:
npm install -D pdf-to-png-converter
Example
const { pdfToPng } = require('pdf-to-png-converter');
test(`Convert PDF To PNG`, async () => {
const pngPages = await pdfToPng(pdfFilePath, {
disableFontFace: false,
useSystemFonts: false,
enableXfa: false,
viewportScale: 2.0,
outputFolder: 'output/folder',
outputFileMaskFunc,
pdfFilePassword: 'pa$$word',
pagesToProcess: [1, 3, 11],
strictPagesToProcess: false,
verbosityLevel: 0
});
});
Output
The output of the pdfToPng
function is an array of objects with the following structure:
{
pageNumber: number;
name: string;
content: Buffer;
path: string;
width: number;
height: number;
}
Buy Me A Coffee
In case you want to support my work: