Question:Basically, what i want to know is, is there any better option on VeryDOC than Apache POI to do a conversion of Office documents - docx,doc,xls,xlsx,odt to a PDF format. I have tried all these options, its working fine for smaller and simpler files. If the documents contains fields, objects, tables etc. those are not properly converted. None of these tools forums are active too. If possible we need to do use ASP only. Any one have any better suggestions?
Answer: According to your needs, maybe you can have a free trail of this software VeryDOC DOC to Any Converter, by which you can convert Office documents - docx,doc,xls,xlsx,odt to a PDF format. By this software, you can convert files with complicated objects, tables etc to PDF. And this software allows you to call it from ASP easily. This software allows you to convert all the printable files to PDF to image and set output properties. Please check more information of this software on homepage, in the following part, I will show you how to use this software.
Step 1. Free download DOC to Any Converter SDK/COM Version
- This COM version allows you to call it together with Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc.
- When downloading finishes, there will be a zip file. Please extract it to some folder then you can use it normally.
Step 2. Convert Office to PDF or image through ASP.
- When you need to convert Office to PDF or image from ASP code, please refer to the following code templates:
Please by following steps to call doc2any.exe inside a special user account,
1. Please download and install EXEShell COM Library (freeware) from following URL first,
2. Please use following ASP code to run the conversion inside a special user account,
Set comEXEShell = Server.CreateObject("exeshell.shell")
RootPath = Server.MapPath(".") & "\"
EXEFile = RootPath & "doc2any\doc2any.exe"
DOCFile = RootPath & "test.doc"
PDFFile = RootPath & "out.pdf"
strCommandLine = EXEFile & " " & DOCFile & " " & PDFFile
response.write strCommandLine & "<br>"
comEXEShell.RunCommandLine "UserName", "Password", strCommandLine
Set comEXEShell = Nothing
You may encounter Error 1314 in some Windows systems when you switch between user accounts, this is caused by permission setting, please refer to the steps in #2 to solve the 1314 Error.
By above code, we can convert doc to PDF without Office installed. Simply change input file formats then you can convert Office to PDF or image through ASP code. During the using, if you have any question, please contact us as soon as possible.