How to set the margin and convert HTML to PDF?

VeryPDF HTML Converter Command Line is originally designed to convert HTML to PDF and other files in the formats including PS (Postscript), TXT, TIF, TIFF, JPG, JPEG, GIF, PNG, BMP, EMF, WMF, PCX, TGA, JP2, PNM. It doesn't depend on print drivers. And it can render web pages quickly and accurately. With the help of VeryPDF HTML Converter Command Line you can perfectly convert HTML to PDF without splitting the original page to multiple PDF pages. VeryPDF HTML Converter Command Line is the right solution to your problem. You can download it by clicking VeryPDF HTML Converter Command Line. After you install it, please read the following instruction which will show how to take three steps to set the margin and convert HTML to PDF via command line.

Step 1: Open the command prompt window

To open the command prompt window, you should click “Start” in the lower-left corner of the computer screen; > click “Run” on the menu; > When the “Run” dialog box appears, enter “cmd” in it. > Click “OK” and the command prompt window will appear on the screen immediately.

clip_image002

clip_image004

Step 2: Type a command line

Type a command line which includes four items as follows: the directory of the executable file, the command for margin setting, the directory of the input file and the directory of the output file. Maybe you would like to take a look at the following pattern which includes the four items.

htmltools -margin <string> <HTML file> <PDF file>

  • htmltools is the main executable file of VeryPDF HTML Converter Command Line.
  • -margin <string> is the command that can be used to set page margin to PDF file. The angle brackets are used to enclose essential elements. string here refers to character string. The parameter value following –margin can be divided into four types:
    • -margin 10 : Set margin to 10pt to left
    • -margin 10x10 : Set margin to 10pt to left, top
    • -margin 10x10x10 : Set margin to 10pt to left, top, right
    • -margin 10x10x10x10 : Set margin to 10pt to left, top, right, bottom
  • HTML file is the input file.
  • PDF file is the output file.

The following is a proper example of command line. It consists of the four items mentioned above, and includes the directories of the files.

D:\htmltools\htmltools.exe -margin 20x20 C:\in\*.html D:\out\*.pdf

  • D:\htmltools\htmltools.exe ---- the directory of the executable file. It represents the executable file htmltools.exe located in the folder htmltools on disk D.
  • -margin 20x20 ---- the command that can be used to set margins to 20pt to left and top.
  • C:\in\*.html ---- the directory of the input files. The wildcard * represents all the input HTML files in the folder in on disk C. The file extension specifies HTML as the input format.
  • D:\out\*.pdf ---- the directory of output files. Here, the file extension specifies PDF as the output format. It indicates that all the result files should be placed in the folder out on disk D.

You can also replace the directories in the example above with the directories of the files in your computer first, then copy it and paste to the command prompt window.

Step 3: Press “Enter”

Press the key “Enter” to let your computer convert HTML to PDF and leave margins to the left and top of the page. When you see “result=OK” in the command prompt window, it means the computer has converted one of the files. If you want to buy the full version of VeryPDF HTML Converter Command Line, please click Purchase. If you want to learn more about how to convert HTML to other files, please read related articles at the knowledge base of VeryPDF.

VN:F [1.9.20_1166]
Rating: 10.0/10 (2 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
How to set the margin and convert HTML to PDF?, 10.0 out of 10 based on 2 ratings

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!