Can I open a “.pdf” document on a blackberry using

2019-02-19 23:44发布

Can I open a ".pdf" document on a blackberry using java?

If yes, then how?

4条回答
Lonely孤独者°
2楼-- · 2019-02-20 00:33

It is not possible to open a PDF file on the BlackBerry from within a Java program. Since OS 4.5 (I think) the BlackBerry has a built-in PDF reader but it only works when you receive a PDF file via email. Not even stored PDF files on the sd card can be opened.

So, "no" it is not possible to open a PDF in Java.

Except of course, when you write a PDF reader first.

查看更多
姐就是有狂的资本
3楼-- · 2019-02-20 00:41

The BB doesn't have a built-in PDF viewer. You can view PDF attachments in emails, but that works with some server-side magic. I think the best approach is to purchase a 3rd-party viewer and launch that to view the PDF.

Possible viewers include the following. I've not tried any of these yet.

I think you'd end up using net.rim.device.api.system.ApplicationManager, but I've not tried it yet.

查看更多
欢心
4楼-- · 2019-02-20 00:45

theres nothin native in blackberry to load pdf files, but you can achieve that loading google viewer inside your Browser field, that will do the trick! =D!

public ScrLoad()
{     
String url = "http://docs.google.com/gview?embedded=true&url=http://prueba.agenciareforma.com/appiphone/android/elnorte.pdf";                
    add(new BrowserField(url));        
}

Google Docs Viewer http://docs.google.com/gview

查看更多
啃猪蹄的小仙女
5楼-- · 2019-02-20 00:47

I'm not sure about Blackberry exactly, but Java 6 SE has a Desktop class which can be used to open a .pdf file with a program associated with that extension, on that platform.

Try something like this:

    if (Desktop.isDesktopSupported()) {
        Desktop desktop = Desktop.getDesktop();
        if (desktop.isSupported(Desktop.Action.OPEN)) {
            File pdf = new File(...);  // path to pdf file
            try {
                desktop.open(pdf);
            }
            catch (IOException e) {
                System.err.println("Could not open " + pdf);
            }
        }
    }
查看更多
登录 后发表回答