Chrome Headless print-to-pdf using PDF file input

Viewed 485

I'm trying to use Headless Chrome to re-print a pdf file from a pdf file.

Similar Post: Print PDF with headless chrome in ubuntu

I've tried several variations of this:

chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf  file://E:/Python/Working/foo_flat2.pdf

chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf  "E:/Python/Working/foo_flat2.pdf"

And no PDF file is generated. When I use a webpage, for example:

chrome --headless --disable-gpu --print-to-pdf=E:/Python/Working/foo_flat3.pdf  https://www.google.com/

It functions as intended, and "foo_flat3.pdf" is generated.

Why am I doing this? I'm trying to make use of Chrome's ability to unlock and flatten pdf files, as it is the fastest option I've found. If there's other options, I would be interested in those too.

0 Answers
Related