This is a proof of concept for generating text documents (Open Document (odt), Word (docx) and Portable Document Format (pdf)) files from HTML and table data using the HTML52PDF library. Edit the HTML and table data below and press one of the document type button at the bottom to create a document.
Some well formed HTML snippet needs to be used
With for example some1 inline formatting1
Without paragraph tag some1 inline formatting1Unordered (bulleted) list:
Ordered (numbered) list:
<?php
require_once 'vendor/html52pdf/CreateDocument.inc';
$doc = new \Html52pdf\createDocument();
$doc->html(array('html' => $html));
if (!empty($data)) {
$table = $doc->table(array('grid' => count($data[0])))->style('border: 1px solid #EEEEEE');
if (!empty($columns)) {
$row = $table->row()->style('background-color: #DDDDDD');
foreach ($columns as $name) {
$row->cell(array('style' => 'border: 1px solid #EEEEEE; padding: 5px 0 0 0'))->paragraph(array('text' => $name))
->style('font-weight: bold; text-align: center');
}
}
foreach ($data as $set) {
$row = $table->row();
foreach ($set as $item) {
$row->cell()->style('border: 1px solid #DDDDDD')->paragraph(array('text' => $item));
}
}
}
$errorReporting = error_reporting(E_ERROR);
$doc->render($filename);
error_reporting($errorReporting);
?>