Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

Adding include-background options #46

Closed ellier7 closed 5 years ago

ellier7 commented 6 years ago

I am not sure how to add the options to include background when using this code:

ex: const RenderPDF = require('chrome-headless-render-pdf');

RenderPDF.generatePdfBuffer('http://google.com') .then((pdfBuffer) => { console.log(pdfBuffer); });

Prinzhorn commented 6 years ago

https://github.com/Szpadel/chrome-headless-render-pdf/blob/e18df40d5e20acdea279ad2bfcdabad018f60edf/index.js#L60

Does that work?

RenderPDF.generatePdfBuffer('http://google.com', {includeBackground: true}).then((pdfBuffer) => {
  console.log(pdfBuffer);
});
Szpadel commented 6 years ago

You can check detailed interface in https://github.com/Szpadel/chrome-headless-render-pdf/blob/master/index.d.ts

And yes, what @Prinzhorn said is correct