Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Bitmap of page not generated properly

More
IP: 192.168.0.71 11 years 7 months ago #6820 by shikhar.shrivastav
My requirement is to generate bitmap of first page.

I am trying to generate Bitmap for first page using the following code

Bitmap bmp=Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
bmp.eraseColor(Color.WHITE);
Matrix mat=new Matrix( values here );
doc.GetPage(0).RenderToBmp(bmp,mat);

I have a few questions, what parameters do I need to pass in the matrix constructor? Also how should I provide the *correct* width and height. I believe providing incorrect values there causes it to rescale it in wrong manner.
More
IP: 192.168.0.71 11 years 7 months ago #6822 by radaee
like these codes:
float scale = 1.2f;//120%
int width = doc.GetPageWidth(pageNO) * scale;
int height = doc.GetPageHeight(pageNO) * scale;
Bitmap bmp = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
bmp.eraseColor(Color.WHITE);
Matrix mat = new Matrix( scale, -scale, 0, height );
Page page = doc.GetPage(0);
page.RenderToBmp(bmp,mat);
page.Close();//it is important.
Time to create page: 0.387 seconds
Powered by Kunena Forum