PDF print formatting
This commit is contained in:
parent
c799a005a9
commit
8b021c234d
29
exportpdf.php
Normal file
29
exportpdf.php
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -231,17 +231,19 @@
|
|||||||
orientation: 'landscape',
|
orientation: 'landscape',
|
||||||
exportOptions: {
|
exportOptions: {
|
||||||
stripNewlines: false,
|
stripNewlines: false,
|
||||||
|
//pageSize : 'A5',
|
||||||
},
|
},
|
||||||
customize: function (doc) {
|
customize: function (doc) {
|
||||||
|
doc.defaultStyle.fontSize = '6'; //<-- set fontsize to 16 instead of 10
|
||||||
doc['content']['1'].layout = 'lightHorizontalLines';
|
doc['content']['1'].layout = 'lightHorizontalLines';
|
||||||
doc.content[1].table.widths =
|
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('');
|
// Array(doc.content[1].table.body[0].length + 1).join('*').split('');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'excel',
|
extend: 'excel',
|
||||||
text: '<?php echo $transLang['EXCEL']; ?>',
|
text: '<?php echo $transLang['EXCEL']; ?>',
|
||||||
orientation: 'landscape'
|
orientation: 'landscape',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user