小编HIM*_*OEL的帖子

使用Android PdfDocument API创建PDF文件 - 文件太大

我尝试使用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)

pdf android

5
推荐指数
0
解决办法
1013
查看次数

标签 统计

android ×1

pdf ×1