How to convert HTML file to PDF file from ASP code on 64bit Windows Server?

This article will let you know how to convert HTML files to PDF files On Web Servers With "VeryPDF HTML Converter Command Line" and "VeryPDFComRunCmd COM Component", you can convert HTML files to PDF files from ASP, PHP, C#, ASP.NET etc, program languages.

VeryPDF HTML Converter Command Line can be downloaded from this web page,

http://www.verypdf.com/app/html-converter/try-and-buy.html#cmd
http://www.verypdf.com/htmltools/htmltools.zip

after you download and unzip it to a folder, you can run following command lines to convert a web page to PDF file first,

htmltools.exe -$ XXXXXXXXXXXXXXXXXX test.htm _test1.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX http://www.verypdf.com _web1.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -html2pdf2 test.htm _test_html2pdf2.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit test.htm _test_webkit.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit http://www.verypdf.com _web_webkit.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit http://www.verypdf.com/artprint/docprintsdk.htm _verypdf_webkit.pdf

htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 test.htm _test_webkit2.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 -width 1080 -height 1080 http://www.verypdf.com _web_webkit2.pdf
htmltools.exe -$ XXXXXXXXXXXXXXXXXX -webkit2 -width 1080 -height 1080 http://www.verypdf.com/artprint/docprintsdk.htm _verypdf_webkit2.pdf

VeryPDFComRunCmd COM Component can be downloaded from this web page,

http://www.verydoc.com/exeshell.html#VeryPDFComRunCmd_COM_Component
http://www.verypdf.com/dl2.php/VeryPDFComRunCmd.zip

after you download and unzip it to a folder, you can run install.vbs to install "VeryPDFComRunCmd.exe" into your system, install.vbs file contains following line,

VeryPDFComRunCmd.exe /regserver

You can also run this command line in CMD window with administrator privilege to register "VeryPDFComRunCmd.exe" into your system.

Now, you can call "VeryPDFCom.RunCmd" from your ASP code to convert from HTML file to PDF file, you can use a simple code at like below,

<%
set VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim nRetVal, bRet
strRet = VeryPDFCom.RunCmd2("D:\VeryPDF\htmltools.exe -webkit http://www.verypdf.com D:\out.pdf", 5)
Response.Write strRet & vbCrlf
%>

You may encounter "Permission denied" error message, like below,

------------------------------------------
Error Type:
Microsoft VBScript runtime (0x800A0046)
Permission denied: 'CreateObject'
/html2pdf.asp, line 22
------------------------------------------

In order to solve "Permission denied" error message, you need give "Full Control" Permission to "Everyone" to "VeryPDFCom.RunCmd", please look at details at following web page,

http://www.verydoc.com/blog/verydoc-release-notes-verydoc-releases-an-exe-com-of-verypdfcomruncmd-exe-today-verypdf-exe-com-does-allow-you-to-call-ms-office-and-any-exe-application-from-asp-php-c-net-etc-program-languag.html

After you give "Full Control" Permission to "Everyone" user account to "VeryPDFCom.RunCmd" DCOM, the "Permission denied" error in ASP will be solved completely, you will able to convert from HTML files to PDF files from ASP code without any problem.

Here is a PHP example to call htmltools.exe application by VeryPDFComRunCmd COM,

<?php

$comobj = new COM("VeryPDFCom.RunCmd") or die("Couldn't create the COM Component");
$strCmd = $comobj->RunCmd2("D:\VeryPDF\htmltools.exe -webkit http://www.verypdf.com D:\out.pdf", 5);
echo("Output is:\r\n" . $strCmd);

?>
 
ASP.NET example to call htmltools.exe application by VeryPDFComRunCmd COM,
<%

dim VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
dim strCmd = "D:\VeryPDF\htmltools.exe -webkit http://www.verypdf.com D:\out.pdf"
Response.Write(strCmd & vbCrlf)
dim strRet = VeryPDFCom.RunCmd2(strCmd, 5)
Response.Write(strRet & vbCrlf)

%>

If you encounter any problem with htmltools.exe application and VeryPDFComRunCmd COM, please feel free contact us, we will assist you asap,

http://support.verypdf.com/open.php

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

Random 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!