Qoppa PDF的Android空指针(Qoppa PDF Android NullPointer

2019-10-23 06:23发布

我真的想qoppapdf在我的应用程序,它运行到下面的代码中的空指针:

 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)

它被用作输入的网址有效且正常工作与其他的PDF查看器。 有没有人经历过这种或类似的问题? 我是不是做错了?

我会很高兴收到你的来信:-)

Answer 1:

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

//这个静态允许SDK访问字体资产,
//它必须之前利用库来设置
StandardFontTF.mAssetMgr = getAssets();



文章来源: Qoppa PDF Android NullPointer