I am using this piece of code:
PDFVPage page = mPages[numberOfPage];
...
// get width and height of page
...
// Rendering process
page.thumbPrepare(width, height, scale);
Bitmap bitmap = mRenderThread.renderThumb(page.m_thumb, width, height);
page.m_thumb.clear();
if (bitmap != null) {
return bitmap;
} else {
throw new IOException("The bitmap has not been rendered");
}
where method renderThumb looks like this:
public Bitmap renderThumb(PDFVThumb thumb, int width, int height) {
return thumb.render(width, height);
}
and code for render method:
protected Bitmap render(int width, int height) {
m_page = m_doc.GetPage(m_pageno);
if (m_bmpw > 0 && m_bmph > 0) {
try {
Bitmap bmp = Bitmap.createBitmap(width, height, Config.ARGB_8888);
bmp.eraseColor(0xFFFFFFFF);
Matrix mat = new Matrix(m_scale, -m_scale, 0, m_bmph);
m_page.RenderToBmp(bmp, mat);
mat.Destroy();
return bmp;
} catch (Exception e) {
return null;
}
}
return null;
}
Then, I need to save preview into the file. I am using this:
www.androidpdf.mobi/forum/Android-develo...f-page-into-the-file