Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Keep It Simple, Stupid
 
PerlMonks  

Re: Converting M$ Word --> PDF

by cfreak (Chaplain)
on Jan 23, 2004 at 17:01 UTC ( #323605=note: print w/ replies, xml ) Need Help??


in reply to Converting M$ Word --> PDF

I've done this for a customer of mine, and no you don't need a Windows machine, or even X running to do it.

I make calls to external programs using IPC::Open3. For a while I was using WVware which has a utility wvPDF for converting from Word to PDF. It worked okay but it has to have latex and a bunch of fonts installed. At some point latex broke and it stopped working. I never have figured out the problem so YMMV. WvWare seemed a bit slow anyway.

Next I tried Anti-Word which is much faster and goes straight to text or to Postscript. I use it for the conversion to Postscript and then use ps2pdf to create the final PDF file. The documents come out perfectly.

Antiword is pretty small so in my spare time I've kind of been looking into ways it could be accessed directly from a Perl module. Not having much spare time or being very good at C has somewhat hindered that progress though :)

Hope that helps,
Chris

Lobster Aliens Are attacking the world!


Comment on Re: Converting M$ Word --> PDF
Re: Re: Converting M$ Word --> PDF
by peterr (Scribe) on Jan 24, 2004 at 00:37 UTC
    Hi Chris,

    I make calls to external programs using IPC::Open3.

    I had a look at that on Cpan and "open a process for reading, writing, and error handling" didn't mean much to me though, sorry I don't understand how I would use that.

    Next I tried Anti-Word which is much faster and goes straight to text or to Postscript. I use it for the conversion to Postscript and then use ps2pdf to create the final PDF file. The documents come out perfectly.

    Antiword is pretty small so in my spare time I've kind of been looking into ways it could be accessed directly from a Perl module. Not having much spare time or being very good at C has somewhat hindered that progress though :)

    I have downloaded the *nix verion, but it looks like I'd need to compile all that in C, ... too much hassle and my brain hurts with that type of stuff. I'm downloading the 'Win' version, because it's a binary, and at a d/load speed of 0.2K/sec, it should be finished by tomorrow. You wouldn't be able to send me the *nix version of AntiWord' would you (please) ?

    Peter

      I have downloaded the *nix verion, but it looks like I'd need to compile all that in C

      Only if you download the source (which is usually what you get if you go directly to the home page of a project, but that's not the usual way most folks install software). You can probably get an Antiword package for your Linux distribution. If you use an RPM-based distro, for example, check on rpmfind.net. Gentoo also has an ebuild for it (app-text/antiword), (though you're probably not using Gentoo if compiling C code gives you a headache). I can't speak for Debian-based distros with any degree of certitude, as I've not recently used any of those except Knoppix, but I suspect apt-get antiword might make you Bob's nephew there. (That's a guess. If it doesn't work, ask someone who uses Debian. Last time I used Debian apt didn't exist yet; there was only dselect.)


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
        Only if you download the source (which is usually what you get if you go directly to the home page of a project, but that's not the usual way most folks install software)

        From the "Linux" version here

        "The programmers' version does not contain any binaries, but the sources can be used to compile a Linux version. The sources can also be used to compile a version for most variations of the Unix operating system as well. Users have reported successful compilations on FreeBSD, Solaris, IRIX, Digital Unix (OSF/1), AIX, SCO and HP-UX"

        Peter

      No offense but the whole idea of Perlmonks is to learn, rather than getting people to do it for you. I don't mind answering questions, even about how to compile but don't give up so easily. Besides I'm on dial-up and it creates several files all of which I'd have to track down and send to you.

      Honestly its not that hard. If you open the readme file all you have to do (on Linux) is type 'make' and then 'make install' for a local installation in your home directory or 'make global_install' to install for the whole system as root. The later is probably what you want. If you aren't on Linux copy the appropriate 'Makefile.<your_os_name>' to just 'Makefile' and follow the same steps.

      As for the IPC::Open3 you don't have to use it, you can use system(), I just found that it gave me more control. See Advanced Perl Programming for some good examples on how to do it.

      Lobster Aliens Are attacking the world!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://323605]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2014-04-20 17:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls