Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Rendering a single page to android.graphics.Bitmap 9 years 11 months ago #8899

  • Kin Chung
  • Kin Chung's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 14
  • Thank you received: 0
After the PDF is opened, I executed the code below:

float w = pdfReader.PDFGetDoc().GetPageWidth(0);
float h = pdfReader.PDFGetDoc().GetPageHeight(0);
float ih = 44 * getDensity();
float iw = ih / h * w;
Page page = pdfReader.PDFGetDoc().GetPage(0);
Bitmap bmp = Bitmap.createBitmap((int) iw, (int) ih, Bitmap.Config.ARGB_8888);
bmp.eraseColor(Color.WHITE);
page.RenderThumb(bmp);

However, the bmp object is still blank. Did I miss out something?

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

Last edit: by Kin Chung.

Rendering a single page to android.graphics.Bitmap 9 years 11 months ago #8901

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi.
if you want to add the bitmap to the page you have to use:
page.RenderToBmp(Bitmap bitmap)
instead of :
page.RenderThumb(bmp);

For more info you can check the documentation and look at this knowledge-base article .
The following user(s) said Thank You: Kin Chung

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

Last edit: by Davide.
  • Page:
  • 1
Powered by Kunena Forum