Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
Jordanr001
Posts: 3
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook OS 2.1.0

How do I open packaged PDFs

I'm currently working on a small webworks app for a PlayBook tablet.

 

Essentially it's an html page with links to pdfs that are packaged with the app.

 

I know you can't embed a pdf.

I know you can open a local pdf saved in the shared documents folder using file:///accounts/1000/shared/documents/test.pdf

 

What I don't know is how to open a pdf stored in the installed apps directory.

For instance (#s being the jumble of alphanumerics of the app):

 

  This works for a test.jpg, no errors.

      file:///accounts/1000/appdata/DirectoryTests#.#/app/air/images/test.jpg

 

   But then I get the error "The file path is not valid" when I try it with a pdf.

      file:///accounts/1000/appdata/DirectoryTests#.#/app/air/pdfs/test.pdf

 

I'm using the following in the config.xml

  <rim: permissions>
     <rim: permit>access_shared</rim: permit>
  </rim: permissions>


  <access uri="file:///accounts" subdomains="true"/>

 

Is this because the Adobe Reader app doesn't have access to the specific directory?

If so is there a way to allow the reader to have said access? ("Config/Security/Application Permissions" does not list Adobe Reader)

 

Any help would be much appreciated!

 

 

BlackBerry PlayBook OS 2.1.0
BlackBerry Development Advisor
anzor_b
Posts: 165
Registered: ‎09-24-2012
My Device: Passport

Re: How do I open packaged PDFs

Hi Jordanr001,

 

This is currently not possible on the PlayBook. On BB10, you can use the invoke api to pass the URL to the PDF Reader as described  here: https://developer.blackberry.com/html5/apis/blackberry.invoke.html

 

One workaround is to have the user download and save the PDF and open it using File Explorer/PDF Reader.

Trusted Contributor
Magnetic_dud
Posts: 121
Registered: ‎03-06-2012
My Device: Z10

Re: How do I open packaged PDFs

If the PDF files are small and not complicated, you can use pdf.js to render them, instead to open them with adobe reader

New Contributor
Jordanr001
Posts: 3
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook OS 2.1.0

Re: How do I open packaged PDFs

Thanks for the reply,

 

I'd rather have the PDFs existing since it is a stand alone webapp (no connection).

That being said, for now the shared data works.

 

However, the default playbook PDF reader has very limited functionality, as lots of you know.

I downloaded qPDF and was quite surprised by it's improvement over Adobe's Reader.

It can't open external links to other PDFs but internal links work correctly.

 

I'll have to test the .invoke function later when we look at BB10 here.

 

BlackBerry PlayBook OS 2.1.0
New Contributor
Jordanr001
Posts: 3
Registered: ‎10-19-2012
My Device: BlackBerry PlayBook OS 2.1.0

Re: How do I open packaged PDFs

Magnetic_dud,

 

The PDF files are quite large and complicated. I doubt I would be able to get pdf.js working properly with them.

 

We do use another WebApp which requires to open small/simple PDFs, and I was looking into pdf.js. It may do the trick if I can get it working properly...

BlackBerry PlayBook OS 2.1.0