0.10.1 • Published 10 months ago

@pixdif/pdf-parser v0.10.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Pixdif PDF Parser

Build Status Npm Package

A PDF parser for pixdif to read PDF files and render each page into an image (PNG format), inspired by pdf.js and node-canvas.

You can install it as a pixdif plugin, or just use it to convert PDF files into images so that any other frameworks can compare or consume them, such as Playwright, WebDriver.IO or Allure Report.

License

MIT

Installation

npm install @pixdif/pdf-parser

Example

import { finished } from 'stream/promises';

const parser = new PdfParser('test/sample/shape.pdf');
await parser.open();

const pageNum = await parser.getPageNum();

for (let i = 0; i < pageNum; i++) {
	const page = await parser.getPage(0);
	console.log(page.getTitle());
	const output = fs.createWriteStream(`output/Page ${i + 1} - ${page.getTitle()}.png`);
	const image = await page.render();
	image.pipe(output);
	await finished(output);
}

await parser.close();
0.10.1

10 months ago

0.10.0

1 year ago

0.9.0

1 year ago

0.8.1

2 years ago

0.8.2

2 years ago

0.7.0

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.0

2 years ago

0.1.2

3 years ago

0.1.1

3 years ago