Page 1 of 1
Display PDFs on Mobile device
Posted: Fri Feb 20, 2015 9:51 pm
by Bromo
Hello LiveCoders!
I have been trying to seek the answer for this question for a few weeks but have not been able to find a perfect solution. I am trying to create a standalone mobile app that can display multiple PDFs. I have reviewed the LiveCode Lessons and they seem to work fine for desktop and maybe they work for mobile but I'm not making the connection.
For example, using: launch document "Getting Started with Revolution.pdf"
allows me to select a PDF that has been saved to my desktop but where do I save a PDF in my app to make it standalone? Also, I've tried the web browser option but I need a PDF viewer that can operate without internet access.
Does anyone know if this is possible? I just want to look at a couple PDFs without internet access on my phone.
Re: Display PDFs on Mobile device
Posted: Sat Feb 21, 2015 4:23 pm
by Klaus
Hi Bromo,
the search function isn't really THAT bad, that one should not use it
OK, what platform?
On iOS you can display a PDF file in a native browser object,
but there are no build-in capabilities on Android.
Best
Klaus
Re: Display PDFs on Mobile device
Posted: Sat Feb 21, 2015 10:33 pm
by jacque
Are you asking how to create PDFs from your stack content? Or something else?
Re: Display PDFs on Mobile device
Posted: Sat Feb 21, 2015 11:24 pm
by SparkOut
Guessing the op really wants to know how to save a PDF along with all the assets of the standalone, and how to retrieve it for display via the standalone on mobile.
I'd give a more detailed answer assuming that's right, but it's painful on this phone
Re: Display PDFs on Mobile device
Posted: Sun Feb 22, 2015 3:35 pm
by newtronsols
You could save a pdf on Google Drive and then use launch url to open it.
Or:
See
http://livecode.com/livecode-7/embedded-web/
Re: Display PDFs on Mobile device
Posted: Sun Feb 22, 2015 10:12 pm
by Bromo
SparkOut wrote:Guessing the op really wants to know how to save a PDF along with all the assets of the standalone, and how to retrieve it for display via the standalone on mobile.
I'd give a more detailed answer assuming that's right, but it's painful on this phone
This is exactly what I'm trying to do. Assume there is no internet connection because you are lost deep in the mountains and therefore cannot access the web. I'd like to be able to pull out my phone and open up a couple of PDFs.
Re: Display PDFs on Mobile device
Posted: Mon Feb 23, 2015 5:47 pm
by jacque
Sorry, I'm still confused. Where is the original content coming from? A downloaded PDF? A printout of the card or a field?
If you mean you want to save stack content, that's done with the "open printing" command using the pdf option.
Re: Display PDFs on Mobile device
Posted: Mon Feb 23, 2015 8:40 pm
by SparkOut
He wants to bundle a PDF document with the standalone to be able to display it on mobile without being connected to internet services
Re: Display PDFs on Mobile device
Posted: Tue Feb 24, 2015 8:03 pm
by jacque
SparkOut wrote:He wants to bundle a PDF document with the standalone to be able to display it on mobile without being connected to internet services
Oh! Thanks for the translation SparkOut. Sorry to be so obtuse.
Bromo: There is no file picker on mobile but you can get "the files" to see a list of available files in a folder and then put that list into a field in your stack. That will allow you to select one of them to launch.
To include the pdfs in your app, I'd put them all into a folder and then add the whole folder to the Copy File pane in the Standalone Settings. When you build the standalone the folder will be included next to the engine. (There's a minor bug with file paths on iOS but it's being fixed. If that's an issue for you, let us know. There's a workaround.)
So now you have the pdf files in a folder that travels with your app and you need a script to get a selected file and launch it. The idea is:
set the defaultFolder to the one containing the pdf files
get the files
display them in a field
And to launch one of them:
get the text of the line the user clicks
launch that file
If you need help scripting that, let us know.
Re: Display PDFs on Mobile device
Posted: Wed Feb 25, 2015 4:22 pm
by Bromo
Jacque,
Thank you for your explanation. I am going to try this it sounds like it could work. You have given me a critical bit of information that I have been searching for. Is it possible for me to script a button so it automatically chooses a file within the folder or will the user always need to select the file?
Re: Display PDFs on Mobile device
Posted: Wed Feb 25, 2015 4:43 pm
by Klaus
Hi Bromo,
Bromo wrote:Is it possible for me to script a button so it automatically chooses a file within the folder...?
we hope so!
Yes sure, presumed you added your PDF file(s) via the "Copy files" TAB in the standalone builder settings as separate files,
you can find them in the final APP here -> specialfolderpath("engine")
...
put specialfolderpath("engine") & "/Name of your PDF here.pdf" into tFile
## Now do something with tFile

...
Best
Klaus