【问题标题】:Qoppa PDF Android NullPointerQoppa PDF Android NullPointer
【发布时间】:2015-08-15 03:39:24
【问题描述】:

我正在我的应用程序中尝试 qoppapdf,它在以下代码中遇到了 NullPointer:

 PDFDocument pdf = null;
    try {
        pdf = new PDFDocument(url, null);
    } catch (PDFException e) {
        e.printStackTrace();
    }
    PDFPage page = pdf.getPage(0);

错误显示:

06-01 17:29:59.687  24761-24761/app W/dalvikvm﹕ Exception Ljava/lang/NullPointerException; thrown while initializing Lcom/qoppa/android/pdfProcess/PDFPage;
06-01 17:29:59.687  24761-24761/app D/AndroidRuntime﹕ Shutting down VM
06-01 17:29:59.687  24761-24761/app W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x413d22a0)
06-01 17:29:59.757  24761-24763/app D/dalvikvm﹕ GC_CONCURRENT freed 2569K, 26% free 10659K/14343K, paused 4ms+13ms, total 68ms
06-01 17:29:59.757  24761-24761/app E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.ExceptionInInitializerError
            at com.qoppa.android.pdfProcess.PDFDocument$1.b(Unknown Source)
            at com.qoppa.android.pdfViewer.e.p.b(Unknown Source)
            at com.qoppa.android.pdfProcess.PDFDocument.b(Unknown Source)
            at com.qoppa.android.pdfProcess.PDFDocument.<init>(Unknown Source)
            at com.qoppa.android.pdfProcess.PDFDocument.<init>(Unknown Source)
            at com.qoppa.android.pdfProcess.PDFDocument.<init>(Unknown Source)

用作输入的 url 是有效的,并且可以与其他 PDF-Viewer 一起正常工作。 有没有人遇到过这个或类似的问题?我做错了吗?

很高兴收到您的来信:-)

【问题讨论】:

    标签: android pdf nullpointerexception pdf-viewer


    【解决方案1】:

    请在加载文档前添加以下代码:

    //这个静态允许sdk访问字体资源,
    //它必须在使用库之前设置
    StandardFontTF.mAssetMgr = getAssets();

    【讨论】:

      猜你喜欢
      • 2013-10-14
      • 2017-03-07
      • 1970-01-01
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 2013-06-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多