Digital Format Conversion tools enable conversion from Microsoft Word (2007+) DOCX format or HTML to EPUB, Kindle and PDF in PHP.
The tools are constructed from a range of Open Source elements, including:
- EPub PHP class (http://www.phpclasses.org/package/6115)
- phpMobi (https://github.com/raiju/phpMobi)
- mPDF (http://www.mpdf1.com/mpdf/)
- PHPDOCX (http://www.phpdocx.com/)
- Twitter Bootstrap (http://twitter.github.com/bootstrap/)
A copy of the source code for these elements are available in /library
http://github.com/benskay/PHP-Digital-Format-Convert-Epub-Mobi-PDF
mPDF is a PHP class which generates PDF files from UTF-8 encoded HTML
http://www.mpdf1.com/mpdf/index.php
FPDFF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library
http://www.fpdf.org/
TCPDF PHP class for generating PDF documents
unoconv convert between any document format supported by OpenOffice. Is written in python. It needs a recent LibreOffice or OpenOffice with UNO bindings.
http://dag.wiee.rs/home-made/unoconv/
Zend_Service_LiveDocx_MailMerge is a SOAP service (aka http://api.livedocx.com) that allows developers to generate word processing documents by combining structured data from PHP with a template, created in a word processor.
Template File Formats (input) : doc / docx / rtf / txd
Document File Formats (output): doc / docx / rtf / txd / html / txt / pdf
http://framework.zend.com/manual/1.12/en/zend.service.livedocx.html
talk direct to http://api.livedocx.com without the Zend -> http://www.phplivedocx.org/articles/using-livedocx-without-the-zend-framework/
stripped down version of sample#1
a test.docx must be near php file, with fields applied aka
<?php // Turn up error reporting //error_reporting (E_ALL|E_STRICT); // Turn off WSDL caching ini_set ('soap.wsdl_cache_enabled', 0); // Define credentials for LD dsefine ('USERNAME', 'x'); //your username define ('PASSWORD', 'x'); //your password <- register to their portal first www.livedocx.com // SOAP WSDL endpoint define ('ENDPOINT', 'https://api.livedocx.com/1.2/mailmerge.asmx?WSDL'); // Define timezone date_default_timezone_set('Europe/Berlin'); print('Starting sample #1 (license-agreement)...'); // Instantiate SOAP object and log into LiveDocx $soap = new SoapClient(ENDPOINT); $soap->LogIn( array( 'username' => USERNAME, 'password' => PASSWORD ) ); // Upload template $data = file_get_contents('test.doc'); //license-agreement-template.docx'); $soap->SetLocalTemplate( array( 'template' => base64_encode($data), 'format' => 'docx' ) ); // Assign data to template $fieldValues = array ( 'software' => 'x', 'licensee' => 'x', 'company' => 'x Co-Operation', 'date' => date('F d, Y'), 'time' => date('H:i:s'), 'city' => 'x', 'country' => 'x' ); $soap->SetFieldValues( array ( 'fieldValues' => assocArrayToArrayOfArrayOfString($fieldValues) ) ); // Build the document $soap->CreateDocument(); // Get document as PDF $result = $soap->RetrieveDocument( array( 'format' => 'pdf' ) ); $data = $result->RetrieveDocumentResult; //echo $result; //write near test.docx file_put_contents('test.pdf', base64_decode($data)); ?>
jsPDF a HTML5 client-side solution for generating PDFs. Perfect for event tickets, reports, certificates, you name it!
https://parall.ax/products/jspdf