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
Regular Visitor
Posts: 1
Registered: ‎08-20-2010
My Device: Not Specified

Invoke a PDF from Widget

Hi,

 

I have a Widget that needs to provide access to some PDF files which are stored locally on the device. Has anyone had success in doing this or something similar?

 

From what I know:

- I can't open the files directly within the Widget as BrowserField does not support PDF content

- I can't invoke the "main" browser to display the files as it does not support local content

 

I was therefore trying to invoke Documents To Go to display the files, but here I ran into a problem. I was able to launch into the app fine using the following (note I am using WordToGo with a .doc file here as my simulator does not have pdf to go available):

 

 

function launchWord()
{
    var args = new blackberry.invoke.JavaArguments('WordToGo');
    blackberry.invoke.invoke(blackberry.invoke.APP_JAVA, args);
}

 

 

This launches WordToGo but I have been unable to pass in the filename as an argument so that the file is automatically opened. I have tried variations on this, to no success:

 

 

function launchWord()
{
    var fileArgs = new Array(1);
    fileArgs[0] = 'file:///store/home/user/myfile.doc';
    var args = new blackberry.invoke.JavaArguments('WordToGo', fileArgs);
    blackberry.invoke.invoke(blackberry.invoke.APP_JAVA, args);
}

 

 

Any suggestions or pointers would be very welcome!

 

Thanks,

     Alan

Regular Contributor
Posts: 76
Registered: ‎02-17-2010
My Device: Storm
My Carrier: Vodafone

Re: Invoke a PDF from Widget

Hello everyone.

Now, I have the same problem as the author of the thread.

Does anyone have an idea?.

Thank you, kind regards.

PS: I'm sorry to reopen a thread a year old.

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Invoke a PDF from Widget

I'm pretty sure that if you use the file.open() method it will open the file with the default application that is associated to its mime type

 

http://www.blackberry.com/developers/docs/widgetapi/blackberry.io.file.html

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter