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

Java Development

Reply
New Contributor
redskins48
Posts: 2
Registered: ‎04-10-2012
My Device: Bold

Invoking DocsToGo/PDFToGo with a remote URL

[ Edited ]

As part of an application I'm creating, it requests a PDF from a web server, and then attempts to display the PDF on the device using any installed PDF reader. If the device has DocsToGo/PDFToGo installed, it should be able to display the PDF without any problems. I've found that invoking PDFToGo with a local device file URL (e.g. "file:///SDCard/aFile.pdf") works perfectly, but invoking with a remote url ("http://www.mywebserver.com/aFile.pdf") fails with PDFToGo displaying a "File Not Found" dialog.

 

I used the following code example from BlackBerry to launch PDFToGo, but it assumes the application is opening a local file already on the device's filesystem, not a remote URL over HTTP:

http://supportforums.blackberry.com/t5/Java-Development/Open-a-file-in-a-Documents-To-Go-application...

 

Here is the code I'm using:

 

//Create the invocation request.
//Invocation invocation = new Invocation("http://www.mywebserver.com/aFile.pdf"); //THIS CANNOT BE OPENED IN PDFToGo
Invocation invocation = new Invocation("file:///SDCard/aFile.pdf"); //THIS OPENS IN PDFToGo

invocation.setAction(ContentHandler.ACTION_OPEN);
invocation.setResponseRequired(false);
            
//Use the registry to perform the invocation.
Registry registry = Registry.getRegistry("com.myapp.ui.BaseScreen");
registry.invoke(invocation);

 Any insight is greatly appreciated! Thanks!

Please use plain text.
New Contributor
buckolas
Posts: 2
Registered: ‎04-10-2012
My Device: Storm 2 9550

Re: Invoking DocsToGo/PDFToGo with a remote URL

[ Edited ]

Hmmm, an interesting scenario. I couldn't get it to work for me either. Anyone else have some ideas?

Please use plain text.
New Contributor
buckolas
Posts: 2
Registered: ‎04-10-2012
My Device: Storm 2 9550

Re: Invoking DocsToGo/PDFToGo with a remote URL

It seems like only you and I are on the cutting edge of BlackBerry technology, Mr. 48.

Please use plain text.
Developer
QuiteSimple
Posts: 1,452
Registered: ‎11-06-2009
My Device: Torch 9810

Re: Invoking DocsToGo/PDFToGo with a remote URL

Download the file to your SDCard and open it from there.

 

I guess remote doesn't work because of security.



"When you become a level 3 developer, you learn to communicate over the ether. I'm told that level 5 developers are ascend into a higher level of existence beyond the physical realm." gord888 @ crackberry
Please use plain text.
New Contributor
redskins48
Posts: 2
Registered: ‎04-10-2012
My Device: Bold

Re: Invoking DocsToGo/PDFToGo with a remote URL

Unfortunately, the security requirements of our app prevent us from storing any data on the device's SD card.

Please use plain text.