How to view PDF in Kony Android WebView/Browser?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

This is an #[Informational Post]

Firstly Kony/Android Browser don't have the capability of loading the pdf. So for viewing the PDF files in the Browser / WebView one has to go by using the following steps:

var myPdfUrl = "Your PDF url"

var url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;

After giving the above link to the browser widget we will be able to view the PDF in WebView.

For Example, if the PDF url is : "http://www.pdf995.com/samples/pdf.pdf"

then,

var myPdfURL = "http://www.pdf995.com/samples/pdf.pdf";

var url = "http://docs.google.com/gview?embedded=true&url="+myPdfURL;

The above steps will help in resolving the issue of viewing PDF in Kony Browser/Webview in Android.

Thanks for sharing knowledge with the community!

A simpler solution, there is a component available in market place called PDF viewer, that can be used.

Please check marketplace link https://marketplace.kony.com/items/pdf-viewer

var url = "http://docs.google.com/gview?embedded=true&url="+myPdfURL;

Am following the same code. But Above URL link is getting error . How i can solve ? Need Suggestions from any one.

Thankq.

What kind of error are you getting? Can you pls elaborate on that.

400. That’s an error.

The requested URL was not found on this server

Can you print the final "url" variable? or the value of "myPdfURL"? Looks like the final link is not a valid one.

can you check if the PDF that are trying to view, Is accessible from the normal browser.?

1.The PDF url is : "http://www.pdf995.com/samples/pdf.pdf" is working fine normal browser.

2.var url = "http://docs.google.com/gview?embedded=true&url="+myPdfURL; is not working in normal browser.

can we know in which browser are you trying to view. as I see if i five the URL in this way I'm able to view the PDF: https://docs.google.com/gview?embedded=true&url=http://www.pdf995.com/samples/pdf.pdf

Can you just check once again

Now working Fine. Thankq.

We're glad it worked. Also please click 'Select as Best' under the response that helped you the most to fix the issue. This way you can close this thread. Thanks!

Am Unable to see the "Select as Best "option.

No worries, let me do on your behalf. Thanks!