html5 report viewer get exported pdf url

1 Answer 60 Views
Report Viewer - HTML5
n/a
Top achievements
Rank 1
Iron
Iron
n/a asked on 24 Oct 2022, 05:34 AM

Hello There

I am using HTML5 Report Viewer and exporting the report on a button click.

 

var rv = $("#reportViewer1").data("telerik_ReportViewer");
rv.commands.export.exec("PDF");

I am getting the PDF url created in exportEnd event of the viewer. All working fine.

 

I am wondering is there a way, i can get the PDF url without exporting, because the built in export is navigating the new tab, which i don't want to go to new tab in mobile browser.

Thank you.

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 24 Oct 2022, 05:51 PM

Hello Ahmedel,

Please take a moment to review the API => exportEnd(e, args) | Telerik Reporting documentation. There, you will see there is an args.windowOpenTarget property available:

windowOpenTarget - change target attribute specifying where to open the browser window. Default value is self.

If you do not want the default behavior, you can change that value to your preferred location.

Regards,
Lance | Manager Technical Support
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
n/a
Top achievements
Rank 1
Iron
Iron
commented on 26 Oct 2022, 04:26 AM

Thank you. 
n/a
Top achievements
Rank 1
Iron
Iron
commented on 26 Oct 2022, 08:17 AM

May i know please if i want to save PDF physically on server after exportEnd event.

Thank you.

Lance | Manager Technical Support
Telerik team
commented on 26 Oct 2022, 03:17 PM

The PDF is already saved on the server is a temporary cache location, that is what the args.url is a reference to.

If you want to save the file again somewhere else on the server permanently, then you'll need to manually perform that action in the exportEnd function yourself.

Custom Implementation

How you save it that depends on what your backend is built with and is up to you. Just design your upload service endpoint to be able to accept a string value, then you can pass the URL to your custom backend logic to save it somewhere else

For example, let's assume:

  • I have an APi controller named "upload"
  • That controller has a POST method named "SavePdfUrl"

I can then make an AJAX request to a custom backend like this:


Notice that I am passing the args.url value to the custom backend logic. Once that custom logic has the URL, it can do whatever it needs to get the file saved somewhere else.

I can show you what my test controller looks like, but this part is entirely up to your server's needs and security considerations (i.e., do not copy mine w/out talking to your security team first).

n/a
Top achievements
Rank 1
Iron
Iron
commented on 27 Oct 2022, 04:08 AM

Thank you again for detailed explanation.
Tags
Report Viewer - HTML5
Asked by
n/a
Top achievements
Rank 1
Iron
Iron
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or