Page 1 of 1

Open and download PDF from app

Posted: Mon Nov 07, 2011 8:07 pm
by Ricardo A
I am new in Livecode. I want to create a simple application for iPad. Basically, I will show a list of PDF files and then the selected file will open on a RevWeb, I imagine. One file per time, one page for each PDF. The user can go back to the list to choice another file and so on. Another requisite is about the PDFs upgrade. They need to be upgraded or changed on-line. I don't know how to do this or if it is possible. I think I will need to work with a kind of database or xml to check the news PDF and download then. Somebody can tell me if LiveCode is the right tool? The iPad iOS allow this upgrade directly from a web repository?

Re: Open and download PDF from app

Posted: Fri Nov 11, 2011 8:28 am
by FireWorx
Hi,
I have just constructed an app that does exactly what you want to do. My app contains about 200 PDF'S that are located in several folders. You will need to use the "Copy Files" tab in the standalone preferences to select these folders and copy them into the "engine" folder. They will then be accessible to be loaded via code into a browser from this folder, be scaled to fit your browser windows width, then once the PDF is loaded zooming and scrolling is done with the touch screen.

If you want your files to be updated through iTunes you will need to move the folders containing the PDF's via code to the "documents" folder. You can access them and load them into the browser from there as well. Live Code 5.0 with IOS 5.0 is much faster at rendering the pages then Live code 4.6 was and you can zoom ALL the way in which you couldn't do in 4.6.

The code can get tricky and working with the documents and engine folder within the AP is kinda like working in the dark because you can't just open the folder and look inside it without building some tools to help you do it from within the tester but I have a few examples I can send you if your up for the challenge. email me at kitethewind@gmail.com

Dave
PS I have seen a script and tried it out that gets a file from a web server and over writes an existing PDF file located in the documents folder.

Re: Open and download PDF from app

Posted: Fri Nov 11, 2011 8:05 pm
by Ricardo A
Dave, I am using LiveCode 5, IOS 5 and XCode 4.2. I want to start from the first step. I managed to copy files from "engine" to "documents". I could write and read text files on engine. But something strange is happening. It's simple. The PDF that exists on engine I can not open in revBrowser. I tried the MobGUI browser without sucssess. A simple locally html is not open. I think I'm missing something simple. Could you send me a livecode sample to open a PDF locally in iPad? This is the first step because I will need to build a app to control about 1000 PDFs with database and show them like you did in your APP, including update with iTunes. Thanks very much.

Re: Open and download PDF from app

Posted: Sat Nov 12, 2011 4:45 am
by Jellicle
Show us your code...

Gerry

Re: Open and download PDF from app

Posted: Sat Nov 12, 2011 12:14 pm
by Jellicle
The code can get tricky and working with the documents and engine folder within the AP is kinda like working in the dark because you can't just open the folder and look inside it without building some tools
The simulator's file structure is available to you. With it running do a search for "iPhone simulator" in the Finder :). You can open files on the simulator and copy files to and from its folders.

Gerry

Re: Open and download PDF from app

Posted: Sat Nov 12, 2011 9:30 pm
by CALL-151
Gerry,

Can you elaborate? With the iOS simulator running my app, I am unable to find files that I know my app has created, or the related folders (engine, cache, etc) by searching via Finder (or Spotlight). I also looked inside the iOS Simulator.app package with no luck.

Re: Open and download PDF from app

Posted: Sat Nov 12, 2011 10:39 pm
by gpb01
CALL-151 wrote:Gerry,
Can you elaborate? With the iOS simulator running my app, I am unable to find files that I know my app has created, or the related folders (engine, cache, etc) by searching via Finder (or Spotlight). I also looked inside the iOS Simulator.app package with no luck.
Hi,
when you run the simulator, the app you're running is into :

~/Library/Application Support/iPhone Simulator/4.3.2/Applications/unique_name_folder_for_your_app

... change the 4.3.2 with the version of the simulator you're using (3.2, 4.0.2, 4.1, 4.3,4.3.2, 5.0)

Hope this help :)

Guglielmo

Re: Open and download PDF from app

Posted: Sat Nov 12, 2011 11:15 pm
by Dixie
Ricardo...

I have attached at stack that contains three small .pdf files... You can choose which of the three you wish to load into the UIwebView and then it will display. These .pdf's are loaded into the 'engine' folder... this is not a good place to keep them, the 'documents' folder is the place if you wish to be able to change them out whenever you wish, or download them from a server... the choice is yours.

There are two cards in the stack, look at the card scripts of both of them...

hope it helps

Dixie

Re: Open and download PDF from app

Posted: Sun Nov 13, 2011 1:48 am
by Ricardo A
I ll work and try on real device with this files. Thanks so much.

Re: Open and download PDF from app

Posted: Sun Nov 13, 2011 10:41 pm
by CALL-151
gpb01 wrote: when you run the simulator, the app you're running is into :

~/Library/Application Support/iPhone Simulator/4.3.2/Applications/unique_name_folder_for_your_app

... change the 4.3.2 with the version of the simulator you're using (3.2, 4.0.2, 4.1, 4.3,4.3.2, 5.0)

Hope this help :)

Guglielmo
Thanks Guglielmo, found it. The ~/Library folder is hidden in Lion.

Re: Open and download PDF from app

Posted: Mon Nov 14, 2011 7:09 pm
by gpb01
CALL-151 wrote: Thanks Guglielmo, found it. The ~/Library folder is hidden in Lion.
:)
... I'm still on Snow Leopard :D

Guglielmo

Re: Open and download PDF from app

Posted: Wed Nov 16, 2011 9:00 pm
by Ricardo A
Hi Dixie, it worked well. Thanks for the sample. And how do I update the PDFs from the server? Some suggestion? Thanks again.

Re: Open and download PDF from app

Posted: Wed Nov 16, 2011 10:03 pm
by Jellicle
Ricardo A wrote:Hi Dixie, it worked well. Thanks for the sample. And how do I update the PDFs from the server? Some suggestion? Thanks again.

My example stack at http://forums.runrev.com/download/file.php?id=1034 shows how to download a stack file from a server. It can download PDFs instead with a little modification.

Gerry

Re: Open and download PDF from app

Posted: Thu Nov 17, 2011 2:57 pm
by Ricardo A
You and others will know when the APP will finish on begining of 2012. i'll put on thanks. God willing. Thanks again.