04-10-2012 02:18 PM - edited 04-10-2012 03:18 PM
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:
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!
04-24-2012 06:06 AM
Download the file to your SDCard and open it from there.
I guess remote doesn't work because of security.