PDF print formatting

This commit is contained in:
Josh North 2021-06-03 12:50:50 -04:00
parent c799a005a9
commit 8b021c234d
2 changed files with 34 additions and 3 deletions

29
exportpdf.php Normal file
View File

@ -0,0 +1,29 @@
<?php
require('inc/Wkhtmltopdf.php');
// pass some stupid stuff so we don't have to global
//$customername = $_POST["customername"];
//$reporttitle = $config['General']['reporttitle'] . ': ' . $customername . ' - ' . date('F j, Y') . ' - ' . date('H:i:s') . '(UTC -5)';
//$datetimestr = date('Y-m-d His');
//$footer = $config['General']['reporttitle'] . ': ' . $customername . ' - ' . date('F j, Y') . ' - ' . date('H:i:s') . '(UTC -5)';
$htmlcontent = $_POST["htmlcontent"];
echo $htmlcontent;
// print
try {
$wkhtmltopdf = new Wkhtmltopdf(array('path' => 'tmp/'));
$wkhtmltopdf->setTitle('test');
$wkhtmltopdf->setHtml($htmlcontent);
$wkhtmltopdf->setOrientation("Landscape");
$wkhtmltopdf->setPageSize("Letter");
$wkhtmltopdf->setFooterHtml('test');
$wkhtmltopdf->output(Wkhtmltopdf::MODE_DOWNLOAD, "test");
} catch (Exception $e) {
echo $e->getMessage();
}
?>

View File

@ -231,17 +231,19 @@
orientation: 'landscape',
exportOptions: {
stripNewlines: false,
//pageSize : 'A5',
},
customize: function (doc) {
doc.defaultStyle.fontSize = '6'; //<-- set fontsize to 16 instead of 10
doc['content']['1'].layout = 'lightHorizontalLines';
doc.content[1].table.widths =
Array(doc.content[1].table.body[0].length + 1).join('*').split('');
doc.content[1].table.widths = ["5%", "5%", "4%", "10%", "15%", "10%","10%", "6%", "10%", "6%", "5%", "14%"];
// Array(doc.content[1].table.body[0].length + 1).join('*').split('');
},
},
{
extend: 'excel',
text: '<?php echo $transLang['EXCEL']; ?>',
orientation: 'landscape'
orientation: 'landscape',
},
]
}