How can I convert a word document to pdf in delphi without using OLE?
I have a number of word (2003 and 2010) documents being sent to a serv开发者_开发技巧er that I want to put into pdf format. As the application runs on a server as a service, I can't use Office to convert it, or to print to a pdf printer.
The only commercial library I have found that might work is activePDF but that is com.
Any other ideas?
OpenOffice can open Word documents and save as PDF. OpenOffice offers a special server mode for remote control.
Some information can be found here How can I use OpenOffice in server mode as a multithreaded service?
Update:
One way to do it is calling JODConverter
java -jar lib/jodconverter-core-3.0-beta-4.jar test.odt test.pdf
(note that even if this refers to Java, it is possible to execute this line from Delphi ;)
The page jodconverter Getting Started page at http://code.google.com/p/jodconverter/wiki/GettingStarted gives additional information, for example that OpenOffice starts in server mode, opens a port 2002 which then can be used to transfer conversion jobs. It also mentions a web application, which could be used from a Delphi client.
With the help some Java developers, this could be used to build a solid document converter, without the need of reinventing the whole wheel in Delphi.
Can you install Microsoft's free "Word Viewer" on the server? If so, and if you can put pdf print driver on server, then you could print to pdf on the server:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=4
精彩评论