Hi,
I am using the vb.net application to generate the pdf file. Earlier I deployed the application in 32 bit machine, based on your advice, I have purchased the 64 bit version. I have followed the steps provided. I can able to generate pdf using html2pdf.exe from command line. But while using pdfcreator.doc2pdfcommandline(str), it is NOT WORKING. str is:
"http://localhost:62008/qasystem/modules/main/SPC_QRTemplates/
630330Lam21Part1/spc_QR_Template.htm""F:/QASystem/modules/
main/SPC_QRTemplates/630330Lam21Part1/918366321.pdf" "paperType=0,margin_left=10,margin_right=10,margin_top=10,
margin_bottom=10"
By the way I forgot to update you that I am using 64bit windows 8.1 version in my machine, I am not able to generate pdf from pdfcreator, whereas I can
create pdf from html2pdf.exe from command line.
Can you help to fix this issue. Your immediate attention will be highly appreciated.
Thanks
Customer
---------------------------------------------------------
pdfcreator COM is a 32bit COM interface, it can only be called from 32bit EXE application, 64bit EXE can't call pdfcreator COM directly.
On the 64bit system, you can use DocConverterCOM_win64.exe to instead of pdfcreator COM, please run a CMD window with administrator privilege, and run following command line in this CMD window to register DocConverterCOM_win64.exe,
-----------------------------------------
DocConverterCOM_win64.exe /regserver
-----------------------------------------
Launch doc2pdf_service.exe,
-----------------------------------------
start doc2pdf_service.exe -exe
-----------------------------------------
DocConverterCOM_win64.exe is support both 32bit and 64bit applications, the COM name is ("DocConverterCOM.pdfout"). You can use DocConverterCOM_win64.exe by following sample code,
-----------------------------------------------------
Set PdfCreator = CreateObject("DocConverterCOM.pdfout")
ConvertHTMLToPDF1 PdfCreator,"http://www.google.com","google001.pdf"
'Convert MS Word document to PDF file
ConvertWordToPDF pdfCreator,"test1.doc","test1.pdf"
'ConvertWordToPDF pdfCreator,"test2.doc","test2.pdf"
'ConvertWordToPDF pdfCreator,"test3.doc","test3.pdf"
'ConvertWordToPDF pdfCreator,"test4.doc","test4.pdf"
set PdfCreator = nothing
function ConvertHTMLToPDF1(byval PdfCreator, strHTMLFile, strPDFFile)
'The first method to create a PDF file from HTML file
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
strPDFFile = strFolder & "\" & strPDFFile
dim strCommandLine
strCommandLine = """" + strHTMLFile + """"
strCommandLine = strCommandLine + " "
strCommandLine = strCommandLine + """" + strPDFFile + """"
strCommandLine = strCommandLine + " "
strCommandLine = strCommandLine + """" + "paperType=6" + """"
MsgBox "HTML To PDF Command Line1 is: " & strCommandLine
PdfCreator.Doc2PDFCommandLine(strCommandLine)
end function
function ConvertWordToPDF(byval PdfCreator, strWordFile, strPDFFile)
Set fso = CreateObject("Scripting.FileSystemObject")
strFolder = fso.GetParentFolderName(wscript.ScriptFullName)
strPDFFile1 = strFolder & "\" & strWordFile
strPDFFile2 = strFolder & "\" & strPDFFile
strCommand = """" & strPDFFile1 & """"
strCommand = strCommand & " " & """" & strPDFFile2 & """"
MsgBox "WordToPDF Command Line is: " & strCommand
PdfCreator.Doc2PDFCommandLine(strCommand)
end function
-----------------------------------------------------
Please look at following web page for more information,
VeryPDF
---------------------------------------------------------
I have followed your instruction to use the 64bit machine.
Dim PdfCreator As New PDFOUTLib.PdfCreator
theURL = FolderPath & thefileURL & "\spc_QR_Template.htm"
folder_path = orderID & ".pdf"
path = folderpathpdf & thefileURL & "/" & orderID & ".pdf"
theURL = theURL.Replace("\", "/")
path = path.Replace("\", "/")
str = """" & theURL & """" & " " & """" & path & """" & " " & """" & "paperType=0,margin_left=10,margin_right=10,margin_top=10,margin_bottom=10" & """"
If File.Exists(path) Then
File.Delete(path)
End If
PdfCreator.Doc2PDFCommandLineEx(str, 1)
The actual str has the below value while run time.
""http://localhost/qasystem/modules/main/SPC_QRTemplates/659857Lam22Part1/
spc_QR_Template.htm" "F:/SBN/Projects/QASystem/edms/modules/main/
SPC_QRTemplates/659857Lam22Part1/921169039.pdf" "paperType=0,margin_left=10,margin_right=10,margin_top=10,margin_bottom=10""
At the same time I can able to create the pdf file using html2pdf in command line. It is working perfectly. I have problem while executing pdfcreator.Doc2PDFCommandlineEx(Str,1).
Please help to solve this problem.
Thanks
Customer
---------------------------------------------------------
HI,
As per your instruction, I have registered the com object,
DocConververCOM_win64.exe /regserver
and start doc2pdf_service.exe,
doc2pdf_service.exe -exe
After that I have given reference to the com object as below,
Imports DocConverterCOM
Dim pdfcreator As New DocConverterCOM.pdfout
theURL = FolderPath & thefileURL & "\spc_QR_Template.htm"
folder_path = orderID & ".pdf"
path = folderpathpdf & thefileURL & "/" & orderID & ".pdf"
theURL = theURL.Replace("\", "/")
path = path.Replace("\", "/")
str = """" & theURL & """" & " " & """" & path & """" & " " & """" & "paperType=0,margin_left=10,margin_right=10,margin_top=10,margin_bottom=10" & """"
PdfCreator.Doc2PDFCommandLineEx(str, 1)
Below will be the str value during the runtime.
""http://localhost/qasystem/modules/main/SPC_QRTemplates/
659857Lam22Part1/spc_QR_Template.htm" "F:/SBN/Projects/QASystem/
edms/modules/main/SPC_QRTemplates/659857Lam22Part1/921169039.pdf" "paperType=0,margin_left=10,margin_right=10,margin_top=10,margin_bottom=10""
Still it is not working. Your immediate attention and help will be highly appreciated.
Thanks
Customer
---------------------------------------------------------
We have another simplest solution to you, you can call html2pdf.exe from your VB.NET application by "VeryPDFCom.RunCmd" COM directly, please look at following web page for more information,
Your VB.NET application will call "VeryPDFCom.RunCmd" COM, this COM will call html2pdf.exe, then you can convert documents to PDF files easily.
The following is an ASP example to call "VeryPDFCom.RunCmd" COM and html2pdf.exe, you can port it to VB.NET code easily.
<%
set VeryPDFCom = Server.CreateObject("VeryPDFCom.RunCmd")
strExeFile = "C:\Installs\doc2pdf_com_full_v2.5\html2pdf.exe"
strPDFFile = server.mappath(".") & "\_verypdf_out.pdf"
strCmd = strExeFile & " " & """http://www.google.com"" """ & strPDFFile & """ ""paperType=9,pageWidth=792,pageHeight=612,Overwrite=yes"""
Response.write strCmd & "<br>"
bRet = VeryPDFCom.RunCmd(strCmd, 5, 0)
Response.write "Return Code = " & bRet & "<br>"
%>