Displaying pdf on a web application

Hi 

I am working on a web app. I have a link on whose click I want to open a pdf in new tab in chrome.

I am getting a pdf url from database. I do not want to use any third party forge component. How to achieve this?

Hi Shubham,

Chrome can display PDFs just fine. Just provide a download link to the PDF, and Chrome will open it inside the browser.

Kilian Hekhuis wrote:

Hi Shubham,

Chrome can display PDFs just fine. Just provide a download link to the PDF, and Chrome will open it inside the browser.

 Hi Kilian

Can't it be done without downloading the file ? Just click on the link and it will go to new tab and open the pdf.


Moreover I do not have actual file. Just a URL.

 

Hi Shubham,

you need to use iframe for showing pdf in browser.


Regards

Rahul Sahu

Solution

Hi Shubham,

You can use the RunJavaScript Server action, referenced from HTTPRequestHandler Extension Module - with the below mentioned JS expression... 

"window.open('" + EncodeJavaScript(GetFileURL()) + "');"

See this Sample App - ShowPDF 


Hope this helps you!


Regards,

Benjith Sam

Solution

Benjith Sam wrote:

Hi Shubham,

You can use the RunJavaScript Server action, referenced from HTTPRequestHandler Extension Module - with the below mentioned JS expression... 

"window.open('" + EncodeJavaScript(GetFileURL()) + "');"

See this Sample App - ShowPDF 


Hope this helps you!


Regards,

Benjith Sam

 Thanks Ben. It worked.

 

Shubham Agarwal wrote:

 Thanks Ben. It worked. 

You're welcome, Shubham :)

Glad it helped you :)


Regards,

Benjith Sam