Most - if not all - new electronic devices don't come with printed manuals. For the Sony laptop SVF15A1 I bought, I had to go to the Sony web site to access the user guide. The user guide is composed of many individual HTML pages. This posted a problem for me because I wanted to convert some HTML pages to PDF documents for easier off-line access.
Modern web browsers, such as Chrome and Firefox, have the built-in print to PDF feature.
For Chrome,
- Navigate to the HTML page, right click, and select Print.
- Select Save as PDF to be the Destination.
- Click Save, and select the output directory to save in.
Note that the output PDF file is automatically named User Guide _ Using the Touch Pad.pdf. I did not have to manually make up the file name because the default name was extracted from the HTML page content. This saves so much time for users that it becomes a major advantage for using the browser print function to do the conversion.
If you prefer a command-line solution, wkhtmltopdf is a simple yet powerful tool to convert HTML to PDF.
$ wkhtmltopdf -s Letter http://docs.esupport.sony.com/pc/SVF14A1_15A1_series/EN/contents/TP0000053442.html UserGuideTouchPad.pdf
Loading page (1/2)
Printing pages (2/2)
Done
wkhtmltopdf can convert HTML files stored on the local hard drive or over the Internet. The above example specifies a URL from the Sony support web site.
By default, the pages in the output PDF file are of the size A4. North American users may specify the page size Letter using the -s parameter.
The last parameter to wkhtmltopdf is the mandatory output file name. Despite its rich set of parameters, it is missing the feature to automatically name the output file. To harness the full power of wkhtmltopdf, please refer to the man page.
If you want to merge individual PDF files, please see my earlier post.
0 comments:
Post a Comment