JustPaste.it


function printdoc()
{

if (window.jsPrintSetup)
{

jsPrintSetup.setOption('marginTop', '<?php echo $this->config->item('print_top_margin'); ?>');
jsPrintSetup.setOption('marginLeft', '<?php echo $this->config->item('print_left_margin'); ?>');
jsPrintSetup.setOption('marginBottom', '<?php echo $this->config->item('print_bottom_margin'); ?>');
jsPrintSetup.setOption('marginRight', '<?php echo $this->config->item('print_right_margin'); ?>');

<?php if (!$this->config->item('print_header'))
{
?>

jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrCenter', '');
jsPrintSetup.setOption('headerStrRight', '');
<?php
}
if (!$this->config->item('print_footer'))
{
?>
// set empty page footer
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrCenter', '');
jsPrintSetup.setOption('footerStrRight', '');
<?php
}
?>

var printers = jsPrintSetup.getPrintersList().split(',');

for(var index in printers) {
var default_ticket_printer = window.localStorage && localStorage['<?php echo $selected_printer; ?>'];
var selected_printer = printers[index];
if (selected_printer == default_ticket_printer) {

jsPrintSetup.setPrinter(selected_printer);


jsPrintSetup.clearSilentPrint();
<?php if (!$this->config->item('print_silently'))
{
?>

jsPrintSetup.setOption('printSilent', 1);
<?php
}
?>
// Do Print


jsPrintSetup.print();
}
}
}
else
{
window.print();
}
}

<?php
if($print_after_sale)
{
?>
$(window).load(function()
{

printdoc();