我尝试使用PdfDocumentAPI 制作PDF .这是我尝试过的:
Paint paint = new Paint();
// create a new document
PdfDocument document = new PdfDocument();
FileOutputStream fos = new FileOutputStream(pdfFile, true);
for (int i = 0; i < mImagePathList.size(); i++) {
//current image path
String imagePath = mImagePathList.get(i);
//get a bitmap
Bitmap bitmap = createBitmap(imagePath); // This method returns a bitmap from path
Drawable d = new BitmapDrawable(getResources(), bitmap);
d.setBounds(0, 0, 100, 100);
// crate a page description
PdfDocument.PageInfo pageInfo = new PdfDocument.PageInfo.Builder(bitmap.getWidth(), bitmap.getHeight(), i …Run Code Online (Sandbox Code Playgroud)