Posts

Showing posts with the label pdf

Reduce PDF file size

We can use ghostscript or ps2pdf:   gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=outputA.pdf input.pdf ps2pdf -dPDFSETTINGS=/screen input.pdf output.pdf   Ghostscript should produce more compatible output.pdf by running twice: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output-Final.pdf outputA.pdf > Reference  

Headless print using chrome

To print to PDF using chrome cli: google-chrome --headless --disable-gpu --print-to-pdf-no-header --print-to-pdf=output.pdf source.html Ref: https://developers.google.com/web/updates/2017/04/headless-chrome Ref: https://stackoverflow.com/questions/55418415/disable-chromes-default-headers-footers-in-headless-print-to-pdf