jump to navigation

Command Line Capture of Web Pages to PDF, PNG, SVG, etc January 5, 2010

Posted by Robert Harder in Utility.

If you’re on a Mac, you probably know that in any application that prints, you can “print” to a PDF file — handy to be sure — but from the command line, it’s not so easy. Enter CutyCapt, a cross-platform tool that lets you capture web pages in a variety of formats including SVG, PDF, PS, PNG, JPEG, TIFF, GIF, and BMP using WebKit as the rendering engine.

Update. I fixed the page size so that CutyCapt creates US Letter sized pages instead of A4 pages. I had to change line 262 of CutyCapt.cpp to printer.setPaperSize(QSizeF(8.5,11),QPrinter::Inch);.

Update, Update. We’re up to OS X El Capitan now, and somewhere along the way I had to switch to wkhtmltopdf (web kit html to pdf), which works. Good luck.