PDF Support

11 replies [Last post]
PatrickDadzio
User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 31 Jan 2010

I would love to sea a PDF support. I was asked several times by clients to add their brochures to the apps I create for them. In the past I converted the pages to images but it would be much easier if Corona would support PDF rendering.

Replies

akhtar
User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 25 Jun 2009

Seconded. This would be a major help for me on the project I am currently working on.

In lieu of PDF, I have modified the Photo album sample from the code samples page so it supports multiple orientations, but it still doesn't zoom - which is something that I need.

Tom
User offline. Last seen 17 hours 13 min ago. Offline
Ansca Staff
Joined: 13 Jul 2010

@akhtar, The Multitouch sample app demonstrates pinch and zoom which can be used to zoom photos.

-Tom

akhtar
User offline. Last seen 2 weeks 5 days ago. Offline
Joined: 25 Jun 2009

Thanks for the tip. I'll see if I can't add that to what I have.

redsummit
User offline. Last seen 51 weeks 4 days ago. Offline
Joined: 7 Sep 2009

+1

jjwhite
User offline. Last seen 1 day 9 hours ago. Offline
Joined: 9 Nov 2010

Is there any way to view a PDF at this point ? I am working on a project now that requires viewing PDF documents.

Appreciate any help

spjnowak's picture
spjnowak
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 21 Aug 2009

You could try loading the PDF into a web view. I haven't tried it in Corona but Mobile Safari supports displaying PDF files directly so it should work.

info158
User offline. Last seen 2 weeks 16 hours ago. Offline
Joined: 14 Mar 2011

It's working fine (I am working on a very similar project), but I can only show remote PDFs or download to the sandbox and then display them.
I need to find a way to always view the PDF, even offline -after it was downloaded. Is this possible??

jjwhite
User offline. Last seen 1 day 9 hours ago. Offline
Joined: 9 Nov 2010

Thank you spjnowak for the suggestion of using web view, it worked. I had tried web view before but for some reason it wouldn't work. It something to do with the parameters. Anyway I'm just glad it's working.
As for the question of working offline, if the PDF is in the sandbox, I would think it would load. With exception of testing offline, my app loads the PDF using web view just fine. I'll test my app offline and post my results today.

info158
User offline. Last seen 2 weeks 16 hours ago. Offline
Joined: 14 Mar 2011

Well, it's working here too by now! I have the PDF-Files in system.DocumentsDirectory. At first start (if offline) there are some PDF to start with in the RecourceDirectory and they are copied to the sandbox (system.DocumentsDirectory).

In case the user is online (at first start) the files are downloaded to that Directory instead of copied from "above".

The documents stay in that sandbox, so it's ok.

My mistake was: Always connecting to the server and then downloading files no matter what. In case you are offline there's nothing to download, but still existing documents will be overwritten (probably with nil)!
Solution was to check fisrt if there's already a document in the DocumentsDirectory..

spjnowak's picture
spjnowak
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 21 Aug 2009

Glad you both found a solution!

Stefan

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.