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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

BB10 - Using HTML5 File API to Save Pdf

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? 



Posts: 366
Registered: ‎07-15-2013
My Device: blackberry Z10
My Carrier: Personal

Re: BB10 - Using HTML5 File API to Save Pdf

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.









If you find this information useful please click like --->
@mezeitune on twitter
Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: BB10 - Using HTML5 File API to Save Pdf

Hello iruka,

Sounds like you are trying to work with a PDF that is hosted externally; just to confirm, are you white-listing the domain that hosts the external PDF inside your config.xml file?

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.
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

Re: BB10 - Using HTML5 File API to Save Pdf

The domain hosting the pdf is included in the config.xml.

BlackBerry Development Advisor
Posts: 769
Registered: ‎10-01-2009
My Device: All
My Carrier: N/A

Re: BB10 - Using HTML5 File API to Save Pdf

[ Edited ]

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-Samples/blob/master/fileTransfer/app/fileDownload.html)

3. In the SUCCESS function of the fileTransfer API call, you will then invoke Adobe Reader (https://developer.blackberry.com/html5/documentation/adobereader.html)


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/blackberry.invoke.html)


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" />