Bitmap of page not generated properly - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about Android development and PDF
  • Page:
  • 1

TOPIC: Bitmap of page not generated properly

Bitmap of page not generated properly 3 years 8 months ago #6820

  • shikhar.shrivastav
  • shikhar.shrivastav's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
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.

Please Log in or Create an account to join the conversation.

Bitmap of page not generated properly 3 years 8 months ago #6822

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
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.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum