在我的应用程序中打开和查看PDF [英] Open and view pdf in my application

查看:101
本文介绍了在我的应用程序中打开和查看PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用这个code:

try {

    URL url = new URL(aurl[0]);
    URLConnection conexion = url.openConnection();
    conexion.connect();

    int lenghtOfFile = conexion.getContentLength();
    Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);

    InputStream input = new BufferedInputStream(url.openStream());
    FileOutputStream fos = openFileOutput("try.pdf", Context.MODE_PRIVATE);
    //PARA DESCARGARLO EN SD//
//  OutputStream output = new FileOutputStream("/sdcard/prueba.pdf");

    byte data[] = new byte[1024];

    long total = 0;

        while ((count = input.read(data)) != -1) {
            total += count;
            publishProgress(""+(int)((total*100)/lenghtOfFile));
            fos.write(data, 0, count);
        }

        fos.flush();
        fos.close();
        input.close();
    } catch (Exception e) {}
    return null;

我一直在应用程序的8 MB大小的PDF文件。我用了几个codeS,试图打开和查看,但无法找到正确的路。

I keep in the application a PDF of 8 MB size. I've used several codes to try to open it and view it but can not find the way.

有什么建议?

推荐答案

请参见下面的SO答案的链接,阅读PDF从SD卡使用PDF查看器。

Please see below SO Answer's link for read pdf from sdcard using PDFViewer.

<一个href="http://stackoverflow.com/questions/11152956/example-of-$c$c-to-implement-a-pdf-reader/11153601#11153601">Read PDF文件

这篇关于在我的应用程序中打开和查看PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆