Convert MHTML (mht) files to PDF files from command line


Very pdf is great product for mht to pdf conversion.i am using the trial version of verypdf (htmltools). My target is to convert mht file to pdf file from c# code. Initially i tried using command line. In command line it is taking 500 as default height for pdf page. So some of the data in my mht file distracted. I have tried by setting bheight, then for my page with 1000 height it is working fine. But my file size may vary. When i tried with a web page it is adjusting it's size automatically. But from mht file not.

Then I tried with sdk, in SDk when i tried with Web page it is working fine. But by using mht file. It is throwing error. It is prefixing http to file name and throwing error.

Please let me know the possible solution for these two.

Thanks in Advance,

Thanks & Regards,

We suggest you may increase the value of "-bwidth" to try again, for example,

htmltools.exe -bwidth 1280 -bheight 1024 D:\in.mhtml D:\out.pdf

btw, we have another product "HTMLPrint to Any Converter Command Line" which can convert MHTML to PDF file too, you may download it from following web page to try,

after you download it, you can run following command line to convert your MHTML file to PDF file,

html2any.exe -printtopdf C:\out.pdf D:\in.mhtml

html2any.exe -printtopdf C:\out.pdf -ps2pdfopt "-ownerpwd owner -keylen 2 -encryption 3900" D:\in.mhtml

html2any.exe -printtopdf C:\out.pdf -ps2pdfopt "-subject \"subject\" -creator \"creator\"" D:\in.mhtml

html2any.exe -printtopdf C:\out.pdf -ps2pdfopt "-$ XXXXXXXXXXXX" D:\in.mhtml

We hope above two solutions will useful to you, please feel free to let us know if you have any question for them.


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!