3

I have a number of word (2003 and 2010) documents being sent to a server 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?

SeanX
  • 1,851
  • 20
  • 28
  • 1
    What does the fact that it's on a server have to do with the fact that you can use Office? If it's a LAN server, there should be no problem. If it's a web server, you could transfer it to a local drive for conversion and then upload again, no? (Yes, it's not elegant.) Am I not understanding something? – RobertFrank Aug 31 '11 at 03:34
  • 1
    @Robert: my guess is the docs are sent to a server (as OP says) and that the app needing to do the conversion is on that server and that server doesn't have MS Office installed... – Marjan Venema Aug 31 '11 at 06:32
  • 2
    The app runs on the server as a service. Office does not work unless there is a user logged in and even then it's a minefield. – SeanX Aug 31 '11 at 20:11
  • 1
    com is mostly a pita. I will use it if I have to but a stright dll or delphi solution would be better – SeanX Aug 31 '11 at 20:12
  • @Robert Frank: It's not that COM is an issue. It's that automating Word/Excel from a service (e.g. ASP.NET) is unsupported and has a number of gotchas. – Ian Boyd Sep 03 '11 at 16:10

2 Answers2

1

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.

Community
  • 1
  • 1
mjn
  • 36,362
  • 28
  • 176
  • 378
  • I have been unable to find any working delphi examples. The one at http://www.oooforum.org/forum/viewtopic.phtml?t=22344 bards when setting the export filter. Do you have any examples? – SeanX Sep 01 '11 at 21:31
0

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

Herbert Sitz
  • 21,858
  • 9
  • 50
  • 54