High-quality PDF to Word conversion in PHP?
https://stackoverflow.com/questions/437716
No correct solution
OTHER TIPS
To read PDF files, you will need to install the XPDF package, which includes "pdftotext." Once you have XPDF/pdftotext installed, you run the following PHP statement to get the PDF text:
content = shell_exec('/usr/local/bin/pdftotext '.$filename.' -');
After getting the content, Download PHPDOCX Community version, try like this.
<?php
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$textInfo = $content;
$paramsTextInfo = array(
'val' => 1,
'i' => 'single',
'sz' => 8
);
$docx->addText($textInfo, $paramsTextInfo);
$docx->createDocx('report.docx');
?>
Openoffice has a PDF import extension. Most of OpenOffice is scriptable, so you should be able to write a command line interface to perform the conversion. There are many examples on the official UNO wiki.
By far the easiest way is with phpLiveDocx. It can load DOC, DOCX and RTF and save to PDF. It can be downloaded from http://www.phplivedocx.org/articles/brief-introduction-to-phplivedocx/ The download file contains a large number of sample applications, which illustrate all aspects of the PHP5 library. Leo