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 Developer
appodictic
Posts: 6
Registered: ‎10-13-2009
My Device: Not Specified

Download and Open a PDF

Hello all,

 

I have been tasked with writing an application that downloads and opens PDF on a blackberry. I have the downloading part solved. How does one go about determing if the target device can view a PDF? Then how do you switch applications to the PDF viewer to view the file? Or can you the PDF inside your own application with some build in object?

 

 

Thank you,

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Download and Open a PDF

Please use plain text.
New Developer
appodictic
Posts: 6
Registered: ‎10-13-2009
My Device: Not Specified

Re: Download and Open a PDF

Yes,

I have read these. (and many like them) It seems odd to me since the blackberry devices have a PDF viewer , but there are no hooks into it like the API like the hooks for the browser. For example from C/C++ i can say System.exec( "open my.pdf" ); Once I download a PDF how can I launch another application and open it. Even if i download a third part PDF browser same problem, how do i launch that program from my code and open the pdf? It seems like the other option is to find some open source Java toolkit.

 

Seems so crazy that a blackberry can view a PDF and you cant just reuse that in any way.

Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Download and Open a PDF

If you get the pdf viewer application module name you could try launching it from your application. Check ApplicationManager class.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.
New Developer
appodictic
Posts: 6
Registered: ‎10-13-2009
My Device: Not Specified

Re: Download and Open a PDF

So ok here is a funny thing

 

When viewing the pdf like this:

 

    BrowserSession browser = Browser.getDefaultSession();
                    browser.displayPage(url);
                    browser.showBrowser();

 

There are no pictures. but when I send the same PDF to my mailbox the blackberry opens its with images.

Can I get the browser to render PDF like the "Open attachment does"

 

I have looked at the application manager,

What is the name of the application that opens the PDF from the mail client?

What is the Module and how can I pass the URL/FileName of the document I wish to open?

 

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: ‎09-30-2009
My Device: Not Specified

Re: Download and Open a PDF

I believe that's because attachment rendering is done server-side; there's nothing on the client that explicitly does this, I think.

Please use plain text.
New Developer
appodictic
Posts: 6
Registered: ‎10-13-2009
My Device: Not Specified

Re: Download and Open a PDF

...I am starting to agree with you. When I open a PDF through email I see the traffic moving back and forth. This leads me to believe that a sever based application is doing conversion and sending JPEG's to the device.

 

BbDeveloper, I would like to try your solution however, I am looking in the ApplicationManager class.

1) what can I do to list all the applications on the device.
--or
2) What is the name of the application that opens PDF

--and--

3)Whar arguments would I have to send to open a file already downloaded to the device.

 

Thank you

Please use plain text.