AddAnnotationBitmap to page - 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

TOPIC: AddAnnotationBitmap to page

AddAnnotationBitmap to page 3 years 10 months ago #6351

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
com.radaee.pdf.Page page = page();

float[] rect = new float[4];
rect[0] = 0; rect[1] = 0;
rect[2] = mAnnotationSurface.surfaceWidth();
rect[3] = mAnnotationSurface.surfaceHeight();
page.ObjsStart();

Bitmap map = mAnnotationSurface.surfaceBitmap();

if(page.AddAnnotBitmap(map, false, rect)) {

page.Close();
mPDF.PDFSave();
}

Using this code the bitmap will not show on the pdf, is there something I am doing wrong?

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

AddAnnotationBitmap to page 3 years 10 months ago #6352

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
I managed to make it work, however, the image is too big and does not display properly, but the bitmap is the same size as the screen. Might be something wrong with the rect, but I cant figure it out.

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

AddAnnotationBitmap to page 3 years 10 months ago #6353

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
Changing the rect code to this

float[] rect = new float[4];
rect[0] = mPDFDocument.GetPageWidth(0);
rect[1] = 0;
rect[2] = 0;

rect[3] = mPDFDocument.GetPageHeight(0);

fixed the visibility issues, though the colors are darker than they should be. Any ideas to fix this?

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

AddAnnotationBitmap to page 3 years 10 months ago #6354

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
like these codes:
PDFPos pos = m_view.vGetPos((int)rects[0], (int)rects[1]);//where rect is in screen coordinate.
PDFVPage vpage = m_view.vGetPage(pos.pageno);
Matrix mat = vpage.CreateInvertMatrix(m_view.vGetX(), m_view.vGetY());
mat.TransformRect(rect);
Page page = vpage.GetPage();
page.AddAnnotBitmap(bitmap, has_alpha, rect);
mat.Destroy();

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

Last Edit: by .

AddAnnotationBitmap to page 3 years 10 months ago #6355

  • manderin87
  • manderin87's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
What view class has the v functions (vGetPos, vGetX)?

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

AddAnnotationBitmap to page 3 years 10 months ago #6356

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 830
  • Karma: 43
  • Thank you received: 10
these codes can be works in PDFReader class, which has m_view member.

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

Powered by Kunena Forum