In PHP, we can use Zend Framework to convert from a Microsoft Word document to PDF file. But i don't know how to convert to PDF in Perl.
The answer depends on what you're trying to accomplish, and whether or not it needs to be pure Perl.
If your intent is to convert to PDF on the fly from a web application, is this because the content going into the PDF is being dynamically generated or modified? In other words, are the Word documents dynamically generated from other data? If so, you may want to sidestep generating the Word documents and turn your data directly into PDF.
If you're simply converting from Word to PDF to get existing static Word documents into PDFs, and if most of the Word docs will need to be also viewed as PDF, and if your disk space is cheap, you may be better off converting all of the Word documents to PDF in advance. But if you expect that the PDFs will need to be generated infrequently, then converting them on the spot may be more efficient.
If you don't need DPI-exact, print-identical conversion, you could use this method, which uses Archive::Zip, XML::LibXML, and XML::LibXSLT to generate the HTML. It's convoluted, but should work.
If you do need print-identical output, other folks seem to be doing this with system calls or using something to call OpenOffice (like The OpenOffice.org Utility Library).
But none of them appear to be pure Perl solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With