09-10-2013 05:49 AM
Hi all. I have been banging my head for days on how to allow user to view pdf attachment on the device.
For some strange, using blackberry.invoke.invoke, the downloaded pdf file size is always zero. Got some advice from this forum to try blackberry.io.filetransfer.download. It was working fine the app is move to Workspace area. Whenever user try to download the pdf, it keeps returning error CONNECTION_ERR.
So I thought of trying to use HTML5 FIle API to donwload, but couldn'nt seem to find any example on using this API with pdf.
Can anyone please help me?
09-10-2013 08:58 AM
Use the FileTransfer API to download the file. In the API call's success callback you can then invoke the PDF viewer to view the file that was just downloaded. Much friendly for the user in my opinion.
09-21-2013 02:56 PM
09-23-2013 11:24 AM - edited 09-23-2013 11:27 AM
I do this with images in an app I made. It should be pretty much exactly like this:
1. User clicks on something which says that they'd like to view the PDF
2. Use the FileTransfer API to download the file. The sample actually shows PDF as a usecase (https://github.com/blackberry/BB10-WebWorks-Sample
3. In the SUCCESS function of the fileTransfer API call, you will then invoke Adobe Reader (https://developer.blackberry.com/html5/documentati
You may need to reference the actual Invoke API as well to make sure all your permissions, and features are setup in the config.xml. (https://developer.blackberry.com/html5/apis/blackb
Sounds like you may have some domain whitelisting issues if you're getting a connect error, or the URL is not proper.
I tend to just disable Web Security in any of my apps which want to talk to more than a couple domains. Makes life easier, but admittedly is a bit of lazy coding on my part. If you find that whitelisting the domain doesn't help, try this.
<feature id="blackberry.app"> <param name="websecurity" value="disable" /> </feature>