I'm compiling using Android 4.4.2 (API19)
but running on Android 4.1.1 API 16
.
Is there an Android support library,or something, so I can use PdfDocument.java
(API 19) in Jellybean API 16
?
code:
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfDocument.Page;
import android.graphics.pdf.PdfDocument.PageInfo;
PdfDocument doc = new PdfDocument();
Error log:
07-22 14:58:41.869: E/dalvikvm(4165): Could not find class
'android.graphics.pdf.PdfDocument', referenced from method com.example.html2pdf.Html2pdfActivity.button1onClick
07-22 14:59:33.965: E/AndroidRuntime(4165): Caused by: java.lang.NoClassDefFoundError: android.graphics.pdf.PdfDocument
Can I package up the required system library and put it in my App ? (or somehow bypass/relocate the system call) ?
CommonsWare
No, sorry, Google has not published a backport of PdfDocument
or pretty much anything related to the Android 4.4+ printing APIs.
ישו אוהב אותך
Still, google has not backported the PdfDocument
API (API 19). But you can use pdfium library from AOSP or the fork from PdfiumAndroid for PDF document.
来源:https://stackoverflow.com/questions/38527965/back-porting-can-use-pdfdocument-api-19-in-jellybean-api-16