After upgrading from 6.0 to 6.1.1 i’m getting an error with pdf output plugin
Error is triggered by line “controller.print(true,true,plugins.pdf_output.endMetaPrintJob())”
Any pointers?
CODE
function printInvoice(event)
{
var success = plugins.pdf_output.startMetaPrintJob()
if (success)
{
if(product_code == "RB")
{
forms.invoiceSubscriptionLetter.controller.print(true,false,plugins.pdf_output.getPDFPrinter());
}
//point to the print form
forms.invoiceDtl.controller.print(true,false, plugins.pdf_output.getPDFPrinter());
}
controller.print(true,true,plugins.pdf_output.endMetaPrintJob())
}
ERROR
Can't find method com.servoy.j2db.FormController$JSForm.js_print(boolean,boolean,[B).
Hi Maarten,
This is because the last argument sent to controller.print(…) should be a PrinterJob, not a byte array as returned by endMetaPrintJob().
The above code is equivalent now to something like:
plugins.pdf_output.endMetaPrintJob();
forms.invoiceDtl.controller.print(true,false);
In 6.0, that line of code you mentioned, which errors out now, would have done the same operations, as above.
The error is due to stronger parameter typing in 6.1. So, in 6.0, print still required PrinterJob as the third argument, only it did not throw an error and would have done the same two operations (ending print job and printing).
Hope this helps,
Andrei
Thanks for clarifying Andrei. Solved.
I indeed also just noticed the arguments clash warning in the script editor.
Hello,
I’m missing something more basic about endMetaPrintJob() – after the job is done, how does one push it out to the web client? This is 6.0.x.
Thanks,
Don
djlapin:
Hello,
I’m missing something more basic about endMetaPrintJob() – after the job is done, how does one push it out to the web client? This is 6.0.x.
Thanks,
Don
Hi Don,
I think your related topic with the answer is here viewtopic.php?f=22&t=18715&p=100864#p100864.
Regards,
Andrei
I just got the same error, upgrading to 6.1. Our “printerJob” parameter was set to Blank ( e.g. ’ ’ )
Just for info, what the heck is a “printerJob” anyway ? I can’t find it defined anywhere
thanks !
greg
Greg, the “PrinterJob” is an object that can be passed/used between the pdf_output plugin and the print command; it’s used to control printing in memory or to a file.
Regards,
Andrei
In Servoy 4, I have the Developer’s Reference in PDF format, where I can find a function, and see examples of it’s use, with parameters
Is there any PDF Documentation for Servoy 6.1, or 7 ? This would be a big help
Note: I tried using “Help” ( F1 ) in Developer, but could not find the Print( Boolean, Boolean, PrinterJob ) Function. Odd
greg
the “PrinterJob” is an object that can be passed/used between the pdf_output plugin and the print command
The current documentation (and also earlier docs) are on the Servoy wiki.
Have a look here for controller.print.
Regards,
Andrei