Automate opening HTML and printing to PDF
Posted
by
craigpatik
on Super User
See other posts from Super User
or by craigpatik
Published on 2012-06-26T20:11:15Z
Indexed on
2012/06/26
21:19 UTC
Read the original article
Hit count: 201
I need a way to automate the following process in Windows 7:
- Open an
.html
file in Internet Explorer - Print to PDF
- 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.
© Super User or respective owner