jsprintsetup打印到卷纸

Anyone know how to set dynamic paper size to the roll paper? I need to print a receipt to the roll paper.

I tried to do it like this

<?php if ($print == 1) { ?>
<script type="text/javascript">
var output = "<?php echo $printOut; ?>";
var mywindow = window.open('about:blank', '_blank', 'location=no,menubar=no,resizeable=no,scrollbars=no,status=no,toolbar=no,height=500,width=300');

mywindow.document.write(output);

// sets printer
jsPrintSetup.setPrinter('zebra');
// set top margins in millimeters
jsPrintSetup.setOption('marginTop', 0);
jsPrintSetup.setOption('marginBottom', 0);
jsPrintSetup.setOption('marginLeft', 0);
jsPrintSetup.setOption('marginRight', 0);
// Set Headers & Footers
jsPrintSetup.setOption('headerStrLeft', '');
jsPrintSetup.setOption('headerStrRight', '');
jsPrintSetup.setOption('footerStrLeft', '');
jsPrintSetup.setOption('footerStrRight', '');
// Set paper size
jsPrintSetup.definePaperSize(101, 101, "Custom", "Custom_Paper", "Custom PAPER", 3, 6, jsPrintSetup.kPaperSizeInches);
jsPrintSetup.setPaperSizeData(101);

// sets silent printing
jsPrintSetup.setSilentPrint(true);
// do print
jsPrintSetup.print();
// restore silent printing
jsPrintSetup.setSilentPrint(false);
//mywindow.close();
window.location.replace("<?php echo $this->createUrl('view', array('id' => $model->id)); ?>");
</script>

But still not working, and the paper is also needed to be rotated 180 degrees. Thank you in advance

Daniel

Have you try these options :

jsPrintSetup.setOption('orientation', jsPrintSetup.kPortraitOrientation);

or

jsPrintSetup.setOption('orientation', jsPrintSetup.kLandscapeOrientation);