Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Can I print to destination "Save as PDF" from a command line with Chrome or Chromium? I'd like to be able to automatically convert html files to PDF with Chrome's built-in functionality.

share|improve this question
    
"Save as PDF" is a virtual printer? In that case it doesn't need to be Chrome or Chromium –  golimar May 8 '13 at 16:24
    
@golimar It is not a virtual printer. Chrome has a built-in option to export to pdf. –  ipavlic May 8 '13 at 19:23
    
I don't see any built-in Chrome switches for saving as PDF. –  Karan May 10 '13 at 1:07
    
@Karan When you go to Print there should be a Save to PDF destination available for you to choose. It's also clearly stated on Google's support page: support.google.com/chrome/bin/… –  ipavlic May 10 '13 at 8:56
    
Perhaps my previous comment wasn't clear. You wanted to know how to do this from the command line, and what I wanted to say was that Chrome/Chromium seem to have no command-line switches/params to do this, although I know you can do it from the UI. You'll need to find some way of triggering the Save As option, perhaps by sending mouse clicks or key strokes. –  Karan May 10 '13 at 14:36

1 Answer 1

up vote 2 down vote accepted

Instead of calling up an entire web-browser, why not use the HTML rendering engine only to do the work? Use wkhtmltopdf to perform the conversion.

wktohtml

You can also convert an existing website to PDF

$ wkhtmltopdf http://google.com google.pdf

Note: technically Google Chrome's rendering engine is Blink, which is a fork of Webkit. There is >90% of common code between Blink and Webkit, so you should get a similar result.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.