How can I set the margin and convert a webpage to PDF?

When you read information on the internet, you may want to save some webpage in the PDF format. However, the web browser doesn’t allow you to directly save the webpage in the format of PDF. Under such circumstances, you have to save the webpage in a format like HTML first and then convert HTML to PDF. Well, only if you have HTML Converter Command Line installed in your computer, you can take only four steps to set the margin and convert webpage to PDF via command line. If you don’t have this application, please download it by clicking VeryPDF HTML Converter Command Line. After you install VeryPDF HTML Converter Command Line in the computer, you can follow the steps below to set the margin and convert the selected webpage to PDF.

Step 1: Save the webpage.

Supposing you are using Firefox browsing information on the internet, you can save the webpage you like in the following way.

Click “File” in the upper-left corner of the window, > click “Save Page As” in the pulling-down list. Then the “Save as” dialog box will pop out. > select a directory in the “Save in” combo box, > type the name for the file. By the way, the default format is HTML. > Click “Save” to save the file on your computer.

the first step to convert webpage to PDF

save the webpage

Step 2: Run the command prompt window

You can run the command prompt window by clicking “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 right away.

Run the command prompt window

Step 3: Type a command line

The command line you are going to type in the command prompt window must be composed of four items: the directory of the executable file, the command for margin setting, the directory of the input file and the directory of the output file. The following pattern may illustrate what should be included in a command line more clearly.

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

  • htmltools is the executable file of VeryPDF HTML Converter Command Line.
  • -margin <string> is the command that can be used to set the margin. The angle brackets are usually used to enclose essential contents. string 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. Remember, you have saved the webpage in the format of HTML.
  • PDF file is the output file.

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

D:\htmltools\htmltools.exe -margin 10x10 C:\in\2.html D:\out\2.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 10x10 ---- the command that can be used to set the margin. With the parameter value 10x10, it can help you set the margin to 10pt to left and top.
  • C:\in\2.html---- the directory of the input files. The file extension shows that the input file is a webpage.
  • D:\out\2.pdf ---- the directory of output files. The file extension specifies PDF as the output format. It indicates that the original file should be converted from webpage to PDF and be placed in the folder out on disk D.

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

Step 4: Press “Enter”

Press the key “Enter”. Your computer will begin to convert the webpage to PDF right away. When you see “result=OK” in the command prompt, it means that the computer has converted the webpage to PDF. If you want to buy the full version of VeryPDF HTML Converter Command Line, please click Purchase. To get more information of other products, please visit the home page of VeryPDF.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in HTML Converter (htmltools) and tagged , , . Bookmark the permalink.

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!