Page 1 of 2
Print Issue
Posted: Wed Aug 19, 2020 5:01 am
by BCS
I been having no problems then suddenly now all pages will have an extra page with them with 0.25in" Top/Bottom margins, I'm guessing because the browser is padding the margins pushing things where they aren't normally. However if i use the "Print to PDF" the margins are respected vs the "Print" button. My question is is there a custom function to call the code behind the "Print to PDF" mechanism like there is with the "Print" button, i have been using viewer.report.print() but I would like to properly use viewer.report.printToPdf() since it seems to be respecting the margins over the normal print method. It appears to have 2 parameters if I don't call it correcting I am seeing this error in the console log
vue.runtime.esm.js?2b0e:1888 TypeError: this.invokePrinted is not a function
at stimulsoft.reports.js:164257
at stimulsoft.reports.js:151015
at i.callTry (stimulsoft.reports.js:58231)
at i.try (stimulsoft.reports.js:58214)
at b.exportToAsync (stimulsoft.reports.js:151011)
at dt.printToPdf (stimulsoft.reports.js:164235)
Currently I am just trying this: viewer.report.printToPdf()
Re: Print Issue
Posted: Wed Aug 19, 2020 5:29 am
by BCS
Alternative is there a way to set the default destination and or the settings the printer dialog uses, say turn off Headers/Footers, paper size, margins (this is the system provided print dialog in chrome for instance)
Re: Print Issue
Posted: Wed Aug 19, 2020 8:16 am
by Lech Kulikowski
Hello,
It is not possible to set printer settings in the Print dialog menu, it is the browser security limitations.
Thank you.
Re: Print Issue
Posted: Wed Aug 19, 2020 1:12 pm
by BCS
What about my original question about the printToPdf method producing an error
Re: Print Issue
Posted: Fri Aug 21, 2020 7:41 am
by Lech Kulikowski
Hello,
We couldn't reproduce the issue. Please send us a sample that reproduces the issue for analysis.
Thank you.
Re: Print Issue
Posted: Fri Aug 21, 2020 9:07 pm
by BCS
I got past this issue by using viewer.report.printToPdf( /** I DON'T KNOW WHAT GOES HERE **/ )
I am asking for the correct API call and its parameters, I don't know the parameters because they are undocumented. My guess is that its expecting something there thats throwing the error in your script, it still prints to pdf though. I'd rather not have the console full of errors though.
Re: Print Issue
Posted: Fri Aug 21, 2020 9:40 pm
by Lech Kulikowski
Re: Print Issue
Posted: Thu Aug 27, 2020 4:57 pm
by BCS
TypeError: this.invokePrinted is not a function
at stimulsoft.reports.js:164257
at stimulsoft.reports.js:151015
at i.callTry (stimulsoft.reports.js:58231)
at i.try (stimulsoft.reports.js:58214)
at b.exportToAsync (stimulsoft.reports.js:151011)
at dt.printToPdf (stimulsoft.reports.js:164235)
Can you provide an example for this, I assume the first parameter of printToPdf() can just be 'null' if not then show me how to use StiPageRange, the second parameter I'm unsure if it wants the ID tag of an element or if I should do something like document.createElement('viewer'). The link you provided me only tells me what can be passed into the function not particularly how to use it properly.
Re: Print Issue
Posted: Tue Sep 01, 2020 9:48 am
by Lech Kulikowski
Hello,
Yuo can use the following code:
viewer.jsObject.postPrint("PrintPdf");
Thank you.
Re: Print Issue
Posted: Tue Sep 01, 2020 9:52 pm
by BCS
Okay I will give that a try and let you know the results.
As a side question is there an API for the Find function you guys have in your toolbar, so that it might be used externally?