RadaeePDF.com :: Topic: Bitmap of page not generated properly (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: Bitmap of page not generated properly

Bitmap of page not generated properly 2 years 11 months ago #6820

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.
The administrator has disabled public write access.

Bitmap of page not generated properly 2 years 11 months ago #6822

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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.
The administrator has disabled public write access.
Powered by Kunena Forum