How to open PDF in new window of Browser

Forum to discuss the new web client version of Servoy.

How to open PDF in new window of Browser

Postby chaitanyas » Sat Sep 23, 2017 10:50 pm

Hi,

I have a requirement to open the pdf file in new window of Browser and pdf is stored in database as byte array. We can easily done this in Servoy webclient but the same procedure is not working in Servoy ng-client.


Any suggestions on how to open pdf in new window of Browser where pdf is stored in database as byte array ?


Thanks In Advance
chaitanyas
 
Posts: 85
Joined: Tue Jul 26, 2011 8:28 am

Re: How to open PDF in new window of Browser

Postby vschuurhof » Mon Sep 25, 2017 4:47 pm

So, can you explain your current approach in the Web Client? Because I am curious to learn what exactly doesn't work in the NG Client.
Vincent Schuurhof
Servoy
vschuurhof
 
Posts: 69
Joined: Tue Dec 14, 2010 12:00 pm

Re: How to open PDF in new window of Browser

Postby chaitanyas » Mon Sep 25, 2017 4:59 pm

Hi,

In Webclient, I used to create a js file in root folder and then open the file using , application.showURL ("/servoy-webclient" + file name , "_blank"), whereas in servoy ngclient, we are hosting the application in Tomcat application server. Not sure, how we can handle this servoy ngclient.
chaitanyas
 
Posts: 85
Joined: Tue Jul 26, 2011 8:28 am

Re: How to open PDF in new window of Browser

Postby vschuurhof » Mon Sep 25, 2017 5:25 pm

This can be done in exactly the same way. You could place the PDF file in the root folder of Tomcat and then show it in the same way as you have done in the Web Client. However, this file is then accessible to anyone who knows or "guesses" the URL.

A safer way (since the original file is coming from the database) is to create a web service with authentication, which returns the PDF file as a binary. By constructing the URL in such a way that it also includes proper credentials, you can show this in a separate tab in the browser, without having to physically place the file somewhere publicly on the disk.
Vincent Schuurhof
Servoy
vschuurhof
 
Posts: 69
Joined: Tue Dec 14, 2010 12:00 pm

Re: How to open PDF in new window of Browser

Postby chaitanyas » Tue Sep 26, 2017 1:38 pm

Thanks a lot vincent for your suggestion, will implement that.

Thanks
chaitanyas
 
Posts: 85
Joined: Tue Jul 26, 2011 8:28 am


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests