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 Developer
Posts: 42
Registered: ‎03-10-2014
My Device: Z30
My Carrier: Bell
Accepted Solution

File Path and how to provide files with the app

Hi there,

 

I would like to include 3 PDF files with my application. What are different ways to do so? How to do it?

 

Thanks,

 

Joe Green

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: File Path and how to provide files with the app

Include to what end? Do you want the user to be able to display the PDF files inside of your HTML5 app?

To "include" them, you simply need them accessible from the root of the project. They can be at the very root level, or in some sub-folder.

To leverage/use those PDF files, it depends on how you want to use them. If you simply want to display them, then something like pdf.js may be of use:
http://mozilla.github.io/pdf.js/

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Developer
Posts: 42
Registered: ‎03-10-2014
My Device: Z30
My Carrier: Bell

Re: File Path and how to provide files with the app

This is my app folder structure

www

index.html

|--js

     |--cordova.js, index.js

|--docs  

    |--2011.pdf

 

and this is what I got in index.js file:

var Invoke = {
    adobeReaderPdf_2011: function() {
        var request = {
            target: "com.rim.bb.app.adobeReader",
            action: "bb.action.OPEN",
            type: "application/pdf",
            uri: "file:///accounts/1000/invoke/docs/2011.pdf"
        };
        Invoke.invokeApp(request);
    },

	invokeApp: function(request) {
        blackberry.invoke.invoke(
            request,
            function() {
                console.log('success');
            }, function(e) {
                console.log('error');
                console.log(e);
            }
        );
    }
};

 

Can you tell me what should be my uri path to 2011.pdf?

Retired
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: File Path and how to provide files with the app

I believe the following should work:

 

uri: "local:///docs/2011.pdf"

Let me know.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
New Developer
Posts: 42
Registered: ‎03-10-2014
My Device: Z30
My Carrier: Bell

Re: File Path and how to provide files with the app

A big thank you, oros, yes, it worked. I can access files in /doc folder now.  The part where I was stuck is that I didn't know to use "local:" instead of "file:".  This is the kind of problem I'm having with app development and web Works API.