How to convert a Word document to a pdf file in perl?

In PHP, we can use the Zend Framework to convert from a Microsoft Word document to a PDF file. But I do not know how to convert to PDF in Perl.

+4
source share
1 answer

The answer depends on what you are trying to execute, and whether it should be pure Perl.

If you intend to convert to PDF on the fly from a web application, is it because the content coming into the PDF is dynamically generated or changed? In other words, are Word documents dynamically generated from other data? If so, you might want to get around creating Word documents and turn your data directly into PDF.

If you just convert from Word to PDF to get existing static Word documents into PDF files, and if most Word documents will also need to be considered as PDF, and if your disk space is cheap, you might be better to convert all Word documents to PDF in advance . But if you expect that PDF files will need to be generated infrequently, then converting them in place may be more efficient.

If you don’t need accurate copying using DPI, you can use this method , which uses Archive :: Zip, XML :: LibXML, and XML :: LibXSLT to generate HTML. It is confusing, but should work.

If you want output with identical prints, other people seem to do this with system calls or use something to call OpenOffice (like the OpenOffice.org Utility Library ).

But none of them is a pure Perl solution.

+1
source

Source: https://habr.com/ru/post/1385080/


All Articles