Page 1 of 1

Direct Printing

Posted: Fri Sep 30, 2022 9:42 am
by admin@secsol.co.uk
I am trying to print directly from my Report (without having to view a preview)

I have create a Report and loaded the report but when I call :

Report.Print();

It throws an Exception error :

System.NullReferenceException: 'Object reference not set to an instance of an object.

Should just calling Print() allow the end user to select the printer and other options ?

Re: Direct Printing

Posted: Fri Sep 30, 2022 11:16 am
by Max Shamanov
Hello,

You can use the following code:

Code: Select all

StiReportResponse.PrintAsPdf(report);
Thank you.

Re: Direct Printing

Posted: Fri Sep 30, 2022 11:56 am
by admin@secsol.co.uk
I tried this after loading my report

StiReportResponse.PrintAsPdf(report);

and nothing happened.... no print or preview or request to save as......

Re: Direct Printing

Posted: Fri Sep 30, 2022 12:02 pm
by admin@secsol.co.uk
Okay, I have found this in the manual : (even though I have a Report Viewer on this page)

StiBlazorHelper.Initialize(JsRuntime);

If I do this first the PDF is displayed n the web browser.

I don't want this, i want to send the PDF to a printer directly not to preview it first

Re: Direct Printing

Posted: Tue Oct 04, 2022 9:00 am
by Max Shamanov
Hello,

Please clarify, is the printer connected on the client side or on the server side?

Thank you.

Re: Direct Printing

Posted: Tue Oct 04, 2022 10:51 am
by admin@secsol.co.uk
The printer is on the client side

Re: Direct Printing

Posted: Tue Oct 04, 2022 12:23 pm
by Max Shamanov
Hello,

Due to the browser security limitations, in the web browsers, it is not possible to send printers settings in print dialog menu.

Thank you.