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).
![Tests on push](https://github.com/dichovsky/pdf-to-png-converter/actions/workflows/test.yml/badge.svg?branch=main)
Getting started
MacOs M1 prerequisites
MacOs M1 dependencies prerequisites installation
arch -arm64 brew install pkg-config cairo pango libpng librsvg
Package installation
Installation:
npm install -D pdf-to-png-converter
Example
test(`Convert PDF To PNG`, async () => {
const pngPages: PngPageOutput[] = await pdfToPng(pdfFilePath,
{
disableFontFace: false,
useSystemFonts: false,
enableXfa: false,
viewportScale: 2.0,
outputFolder: 'output/folder',
outputFileMask: 'buffer',
pdfFilePassword: 'pa$$word',
pagesToProcess: [1, 3, 11],
strictPagesToProcess: false,
verbosityLevel: 0
});
...
});
Output
{
pageNumber: number;
name: string;
content: Buffer;
path: string;
width: number;
height: number;
}
Buy Me A Coffee
In case you want support my work
!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)