How to set the margin and convert MHT to PDF?

Most Web pages viewed in a Web browser only contain HTML and reference images and other media files that are stored in other directories on the server. Because all the files are encoded into a single file in a MHTML document, MHT files are commonly used to archive Web pages.

If you want to set the margin and convert MHT to PDF, you are strongly recommended to use VeryPDF HTML Converter Command Line, which is a powerful document converter that can help you batch convert web page files in the formats like HTML, HTM, and MHT to PDF and other file formats like TIF, PCX, PNM, JPEG and JPG. With the help of VeryPDF HTML Converter Command Line, you can take three steps to solve your problem. To download it, please click VeryPDF HTML Converter Command Line

After you install it, please follow the steps below to set the margin and convert MHT to PDF yourself.

Step 1: Open the command prompt window

It requires four steps to open the command prompt window: 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.

 Open the command prompt window

 command prompt window

Step 2: Type a command line

You should type the following four items in the command prompt window: 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 can take a look at the following pattern to see what item should be included in the command line.

htmltools -margin <string> <MHT 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
  • MHT file is the input file.
  • PDF file is the output file.

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

D:\htmltools\htmltools.exe -margin 15x15 C:\in\*.mht 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 15x15 ---- the command that can be used to set margins to 15pt to left and top.
  • C:\in\*.mht ---- the directory of the input files. The wildcard * represents all the input MHT files in the folder in on disk C. The file extension specifies MHT 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”, and your computer will begin to convert MHT to PDF. When you see “result=OK” in the command prompt, it means the computer has converted one of the files. To buy the full version of VeryPDF HTML Converter Command Line, please click Purchase. To learn more about how to convert MHT to other files, please read related articles at the knowledge base of VeryPDF. 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

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!