in reply to Re: Convert .doc to .pdf
in thread Convert .doc to .pdf

I have done this at $work, unfortunately, I am unable to release it outside of my cubicle walls. But I will say that it is based heavily on the code sample found at http://www.codeproject.com/office/PortableOpenOffice.asp, and hooked into an Apache server via a CGI call. Oh, just so it applies to PerlMonks, the CGI wrapper is a Perl script that does some pre and post processing on the file validation testing, meta-data fillin, etc.

--MidLifeXis

Replies are listed 'Best First'.
Re^3: Convert .doc to .pdf
by pKai (Priest) on Feb 01, 2007 at 00:13 UTC

    Very nice.

    I just tried this with OO 2.0.2

    Built the macro, as described in the article you linked to.

    Since I was not interested in a CGI wrapper, the only interesting stuff in the the ASP/C# stuff in the download acompanying the article is how to call it (Win here):

    path_to_OO_executables\swriter.exe macro:///ConversionLibrary.PDFConve +rsion.ConvertWordToPDF(Word.doc,Output.pdf)

    (I used the same names as in the article)

    Assemble that command line dynamically with the file names needed, run it as a background process, and you are done.

    Worked fine, except for an "ErrorCodeIOException" occuring at the export call...

    Hm, took me a few minutes to realise, that it was not my fault, but a known bug in V2.0.2. ;-/

      You would earn the gratitude of thousands of Perlers if you would take that solution and wrap it in a CPAN distribution. Maybe take a look at Alien to guarantee the OpenOffice installation. It sounds dumb to release a CPAN distribution for just a few lines of a system call, but it's a really big deal to be able to interface with this process using a Perl module. And, if you built it generically enough, then you could very easily extend this to wrap all the format manipulations that OO provides. THAT would be awesome!

      My criteria for good software:
      1. Does it work?
      2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?