Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a way to automate the following process in Windows 7:

  1. Open an .html file in Internet Explorer
  2. Print to PDF
  3. Save the PDF with a patterned file name (i.e., original_name_YYYY-MM-DD.pdf)

Ideally, I could drag and drop several files or open a whole folder of files at once and a PDF would be created for each one. A command line solution is also acceptable.

The files have to be opened in the browser because parts of the page are rendered with JavaScript on page load. In other words, if you simply right-click on the file in Explorer and choose "print", the resulting file is not the same because the JS didn't run.

If it helps, Internet Explorer can be set as the default browser, and a PDF printer can be set as the default printer.

share|improve this question
What have you tried so far? Where are you getting stuck? Right now this is a list of wants, not a question. ;) – Ƭᴇcʜιᴇ007 Jun 26 '12 at 20:20
If you're adventurous enough, you can automate this task with AutoHotkey. I'll check back later and work this out if you haven't found a solution yet. :) – iglvzx Jun 26 '12 at 20:29
@techie007: I am getting stuck because the converters I've found parse the HTML themselves and I need IE7 to parse it. iglvzx: Thanks, I will try that if affinefesh's suggestion doesn't pan out. – craigpatik Jun 28 '12 at 16:03

If internet explorer is not a requirement, this is kind of an older project, but I have used it with great success. It will allow you to specify a HTML page (On the internet or on your computer) from the command line and will automatically save it to a specified PDF file or even an image. Usage information is here.

share|improve this answer
Does it execute JavaScript in the process before printing? This is the main requirement for @craigpatik ... – iglvzx Jun 27 '12 at 5:24
It does. It uses webkit so it is a full featured renderer. – DanielG Jun 27 '12 at 14:25

HTML-TO-PDF batch converts HTML documents to PDF. Makes use of Internet Explorer and ABCpdf, so the results should match what you expect to see in IE.


screenshot of HTML to PDF

share|improve this answer
Does it execute JavaScript in the process before printing? This is the main requirement for @craigpatik ... – iglvzx Jun 27 '12 at 5:24
Yes. Note that documents are generated as soon as a page has finished loading and JavaScript animation with an initial blank state won't show up unless the rendering process is delayed. – AffineMesh Jul 3 '12 at 4:32

Your Answer


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.