Qoppa PDF Android NullPointer [英] Qoppa PDF Android NullPointer
问题描述
我正在我的App中尝试qoppapdf,并在以下代码中遇到了NullPointer:
I`m trying qoppapdf in my App and it runs into an NullPointer in the following code:
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一起正常使用. 有没有人遇到这个或类似的问题?我做错了吗?
The url which is used as input is valid and works fine with other PDF-Viewer. Does anyone experienced this or similar problems? Am I doing it wrong?
很高兴收到您的来信:-)
I would be pleased to hear from you :-)
推荐答案
在加载文档之前,请添加以下代码:
Please add the following code before loading the document:
//此静态值允许sdk访问字体资产,
//必须在使用库之前进行设置
StandardFontTF.mAssetMgr = getAssets();
//this static allows the sdk to access font assets,
//it must be set prior to utilizing libraries
StandardFontTF.mAssetMgr = getAssets();
这篇关于Qoppa PDF Android NullPointer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!