核心代码如下:
PDFPage page = doc.getPage(i);
// Parse page.
page.startParse(e_ParsePageNormal, null, false);
int width = (int) page.getWidth();
int height = (int) page.getHeight();
Matrix2D matrix = page.getDisplayMatrix(0, 0, width, height, page.getRotation());
// Prepare a bitmap for rendering.
Bitmap bitmap = new Bitmap(width, height, e_DIBArgb, null, 0);
bitmap.fillRect(0xFFFFFFFF, null);
// Render page
Renderer render = new Renderer(bitmap, false);
render.startRender(page, matrix, null);
image.addFrame(bitmap);
在您获取当前页码时,即可获得Page对象,然后引入上述代码即可。