Q : I am trying to load a PDF document using Qoppa’s Android PDF toolkit and getting the following error:

Caused by: java.lang.NullPointerException
at android.graphics.Typeface.nativeCreateFromAsset(Native Method)
at android.graphics.Typeface.createFromAsset(Typeface.java:149)
at com.qoppa.android.pdfViewer.fonts.StandardFontTF.getTypeface(Unknown Source)
at com.qoppa.android.pdfViewer.fonts.StandardFontTF.getFont(Unknown Source)
at com.qoppa.android.pdfViewer.fonts.t.b(Unknown Source)
at com.qoppa.android.pdfProcess.PDFPage.(Unknown Source)

A: You need to load the font assets before using our library.

//this static allows the sdk to access font assets,
//it must be set prior to utilizing libraries
StandardFontTF.mAssetMgr = getAssets();
 
//load a PDF document
PDFDocument pdfdoc = new PDFDocument(file.getAbsolutePath(), null);

There is no need to call getAssets() if you are displaying PDF documents in QPDFNotesView or PDFViewerView, only when loading PDF documents outside of the view.