Sparticuz / node-qpdf2

A Content Preserving transformations on PDFs wrapped around QPDF
MIT License
20 stars 16 forks source link

puppeteer and node-qpdf2 #35

Closed masterbater closed 1 year ago

masterbater commented 1 year ago

Ive got this pdf buffer, does this lib supports buffer, and also output it as buffer in the latest version?

  const pdfBuffer = await page.pdf({
        format: 'A4',
        printBackground: true,
        timeout: 100000,
      });
Sparticuz commented 1 year ago

Qpdf doesn't support input from stdin, so no. But it does let you output as a buffer. Check out https://github.com/Sparticuz/node-qpdf2/blob/master/test/encrypt-and-decrypt.ts for examples

https://github.com/qpdf/qpdf/issues/54

You need to write it to /tmp then put that path into node-qpdf

masterbater commented 1 year ago

I got it working thanks I added path to puppeteer, only problem was the esm, I need to downgrade to v4 since Im using it in nestjs