Page 1 of 2

Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 6:05 pm
by Rolf

Hi there,
been looking through the forum, but couldn't find any clear answer....

I have some PDFs to include in my app. Uploaded them to Webresources/views/assets/images and so far so good.
As they are really needed offline, linking to a website wouldn't do the job.

Basically, I'd like to include a link so the user can click on the link (or an image as a link) and the PDF will open in an application (eg webbrowser) on the device of this users. Comparable with clicking on an attachment in an email, or with 'open in new window' in a web browser.

How do I do this?
I've read about InAppBrowser as an option, how do I get this to work with such a file?


Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 6:27 pm
by Rolf

BTW,
I've tried to use 'navigate to link' with 'open in new window' checked..... works to open the file, but after pressing 'done' I get a completely blank screen ;-(


Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 6:31 pm
by Maryna Brodina

Hello! Try this way prewindow.open(encodeURI('full/path/to/file.pdf'), '_system');/pre


Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 7:15 pm
by Rolf

Sorry, that doesn't work (tried that).
I get only a completely white page and in contrast with 'navigate to link' even the PDF doesn't open.....
Testing in iOS7 on the device and in online tester (there the pdf opens in new tab, but the white screen remains)....

What am I missing?


Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 7:59 pm
by Maryna Brodina

Could you clarify what file path you use in code?


Open a local PDF in iOS and Android

Posted: Thu Mar 06, 2014 11:15 pm
by Rolf

files/views/assets/image/testpdf.pdf

This path did work in the 'navigate to link' tool (but that also had a problem, as the return screen was completely blank)


Open a local PDF in iOS and Android

Posted: Fri Mar 07, 2014 1:34 pm
by Nikita

Hello,

It works fine for me. Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a
and specify app's name. We'll check it.


Open a local PDF in iOS and Android

Posted: Fri Mar 07, 2014 5:03 pm
by Rolf

Hi Nikita,
I've shared the app (AIDapp) with you.
The link is now on the 'info' page.

Thanx!


Open a local PDF in iOS and Android

Posted: Sat Mar 08, 2014 5:22 pm
by Alena Prykhodko

Hello Rolf, please tell steps to test the issue within app (page name) and on Preview.


Open a local PDF in iOS and Android

Posted: Mon Mar 24, 2014 8:40 pm
by Rolf

Hi Appery-staff,
sorry for the late reply, seems my initial reply was not published here....

The link (to a test-PDF included in the app) can be found on the page you end up on when you click 'Information' from the home menu.

When you first launch the app, you should select a language (Dutch or English, I'd advise English ;-), you don't need to login etc.