PdfActivity.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:NotifyTools 作者:
private void showPage(int indexx) {

        if (mPdfRenderer.getPageCount() <= indexx) {
            index=mPdfRenderer.getPageCount()-1;
            return;
        }
        // Make sure to close the current page before opening another one.
        if (null != mCurrentPage) {
            mCurrentPage.close();
        }
        // Use `openPage` to open a specific page in PDF.
        mCurrentPage = mPdfRenderer.openPage(index);
        // Important: the destination bitmap must be ARGB (not RGB).
        Bitmap bitmap = Bitmap.createBitmap(mCurrentPage.getWidth(), mCurrentPage.getHeight(),
                Bitmap.Config.ARGB_8888);
        // Here, we render the page onto the Bitmap.
        // To render a portion of the page, use the second and third parameter. Pass nulls to get
        // the default result.
        // Pass either RENDER_MODE_FOR_DISPLAY or RENDER_MODE_FOR_PRINT for the last parameter.
        mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
        // We are ready to show the Bitmap to user.
        imgPdf.setImageBitmap(bitmap);
        mAttacher.update();
        updateUi();
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号