Print Issue

Stimulsoft Reports.JS discussion
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Print Issue

Post 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()
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post 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)
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post 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.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post by BCS »

What about my original question about the printToPdf method producing an error
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue. Please send us a sample that reproduces the issue for analysis.

Thank you.
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post 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.
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post by Lech Kulikowski »

BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post 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.
Lech Kulikowski
Posts: 6265
Joined: Tue Mar 20, 2018 5:34 am

Re: Print Issue

Post by Lech Kulikowski »

Hello,

Yuo can use the following code:
viewer.jsObject.postPrint("PrintPdf");

Thank you.
Attachments
photo_2020-09-01_11-48-27.jpg
photo_2020-09-01_11-48-27.jpg (69.07 KiB) Viewed 1882 times
BCS
Posts: 83
Joined: Thu Nov 17, 2016 5:47 am

Re: Print Issue

Post 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?
Post Reply