oakb has asked for the wisdom of the Perl Monks concerning the following question:

Good day, Brothers of Perl Wisdomness,

I am looking for the easiest way to convert an RTF document -- complete with images -- into a PDF document that has the same basic format.  I have found CPAN modules for converting RTF to text or HTML, but nothing for RTF to PDF.  I really want to avoid an intermediate format (i.e. RTF -> HTML -> PDF) if possible.  These are medical documents, so getting the formatting and images right every time is crucial.

I prostratedly submit my humble request for guidance,

-Brian

Replies are listed 'Best First'.
Re: RTF to PDF conversion...with images
by NiJo (Friar) on Jun 24, 2009 at 18:34 UTC
    I'd use MS write as a pre-installed application reading RTF and printing to a PDF printer. Your perl just needs to control the process, maybe by using a "print to PDF" dll.

    I'm working in software validation for the pharmaceutical industry, so I know that customers would highly prefer use of standard software. The development and validation effort for a perl script is much higher.

    Getting into touch with the final customer might be difficult in your position, but would be worth it.

Re: RTF to PDF conversion...with images
by MidLifeXis (Monsignor) on Jun 24, 2009 at 16:07 UTC

    Try using Open Office. You can drive it with a UNO macro or Win32::OLE.

    --MidLifeXis

    The tomes, scrolls etc are dusty because they reside in a dusty old house, not because they're unused. --hangon in this post

      MidLifeXis,

      Thank you for your input!  This application needs to be entirely self-contained, however, and there is no way that I can demand that users install something as huge as OO.o -- or include it as part of my installation. There are actually smaller third-party tools (see, e.g., pdfforge.org) available out there for doing this, but I need to accomplish this within my own application.  Do you have any ideas for doing this entirely within Perl?

      -Brian

        Aaah, this is for on a customer machine. That makes a difference. I took the OP as doing a batch conversion or a document server of some sort.

        In the described case, I would agree, OO with a perl driver may not be the easiest sell.

        --MidLifeXis

        The tomes, scrolls etc are dusty because they reside in a dusty old house, not because they're unused. --hangon in this post