Hi there,
I am wondering how can I output a print-preview to pdf without showing a print preview.
I have tried the following but it did not work properly:
//*****************************************//
var frmObj = forms.product_print2;
var success = plugins.pdf_output.startMetaPrintJob('d:/mht_printout.pdf')
if (success) {
frmObj.controller.showPrintPreview( false, plugins.pdf_output.getPDFPrinter());
}
plugins.pdf_output.endMetaPrintJob();
plugins.dialogs.showInfoDialog("", "done");
Harjo
2
did you try: print instead of showPrintPreview?
I tried print and it worked. But my print layout is a label print layout.
I have set pageBreakAfterOccurrence = 8
So it is supposed to prints 8 labels in a page. That’s why I wanted to output it from printPreview()
If I just try print() then it prints one label per page.
Any idea please. I need to do the printing as soon as possible.
Thanks a lot.
You are saying that printpreview shows 8 records on one page, but when you try to do a real (pdf) print is generates 8 pages?
This seems impossible to us, since it is the same code…
The controller.showPrintPreview() prints 8 records per page.
Now I wanted to print it to a PDF using pdf plugin. But the following code never prints to pdf.
//*****************************************//
var frmObj = forms.product_print2;
var success = plugins.pdf_output.startMetaPrintJob('d:/mht_printout.pdf')
if (success) {
frmObj.controller.showPrintPreview( false, plugins.pdf_output.getPDFPrinter());
}
plugins.pdf_output.endMetaPrintJob();
plugins.dialogs.showInfoDialog("", "done");
The following code works but print one record per PDF page.
//*****************************************//
var frmObj = forms.product_print2;
var success = plugins.pdf_output.startMetaPrintJob('d:/mht_printout.pdf')
if (success) {
frmObj.controller.print(true,false,plugins.pdf_output.getPDFPrinter());
}
plugins.pdf_output.endMetaPrintJob();
plugins.dialogs.showInfoDialog("", "done");
Are you sure you try to print(preview) the same form? (your post suggests not)
but if so, could you reproduce this in a sample?
Sorry Jan,
I got it working using controller.print();
Since I was wrongly trying to print current record instead of the foundset it just gave me one record.
frmObj.controller.print(true,false,plugins.pdf_output.getPDFPrinter());
Now I use
frmObj.controller.print(false,false,plugins.pdf_output.getPDFPrinter());
and it works fine.
But the first method never worked.
frmObj.controller.showPrintPreview( false, plugins.pdf_output.getPDFPrinter());
never prints to pdf