When you need to convert HTML to PDF under multi-platforms by command line, maybe you can have a free trial of software VeryPDF HTML to Any Converter Command Line. This software can work under Windows, Mac OS X and Linux operation systems. Meanwhile by it, you can also convert local and online HTML files to PDF and image by command line easily. Please check more information on homepage, in the following part, let us check how to use this software.
- There are three versions of this software on Try-and-Buy website, so please download the proper version according to your computer system. Here I will take the command line Mac version for example.
- When downloading finishes, there will be a .dmg file. You need to extract it to folder by double clicking. Then you can find executable file, help document and other related files.
Step 2. Convert HTML to PDF under Mac system by command line.
- When you use this software, please refer to the usage and examples.
- Here is the usage for your reference: html2any [options] <input file> <output file>
- When converting HTML file to PDF, please refer to the following command line templates.
By this command line, we convert online website to PDF and then change the DPI explicitly (this has no effect on X11 based systems).
html2any -dpi 400 https://www.verypdf.com/ _dpi.pdf
When you need to enable installed plugins (such as flash) in PDF and convert online website to PDF.
html2any -enable-plugins https://www.verypdf.com/ _enable-plugins.pdf
The following command line template can help you set the default text encoding of UTF-8 when converting online files to PDF.
html2any -encoding UTF-8 https://www.verypdf.com/ _encoding.pdf
When you need to convert online HTML to PDF and make it to in grayscale, please refer to the following command line template.
html2any -grayscale https://www.verypdf.com/ _grayscale.pdf
By this command line, we can convert online HTML file to PDF and set the page bottom margin (default 10 mm):
html2any -margin-bottom 10 https://www.verypdf.com/ _margin-bottom.pdf
html2any -margin-left 10 https://www.verypdf.com/ _margin-left.pdf
Now let us check related parameters:
-l <int> : Specify the last page to convert.
-margin-bottom <unitreal> : Set the page bottom margin (default 10 mm).
-margin-left <unitreal> : Set the page left margin (default 10 mm).
-margin-right <unitreal> : Set the page right margin (default 10 mm).
-margin-top <unitreal> : Set the page top margin (default 10 mm).
-minimum-font-size <int> : Minimum font size (default 5).
-no-background : Do not retain background.
-orientation <orientation> : Set orientation: Landscape/Portrait. Default is Portrait.
-page-height <unitreal> : Page height (default unit millimeter).
-page-width <unitreal> : Page width (default unit millimeter).
-page-size <size> : Set paper size to: A4, Letter, etc.
If you need to know more parameters and examples, please check in readme.txt. During the using, if you have any question, please contact us as soon as possible.