RadaeePDF.com :: Topic: AddAnnotationBitmap to page (1/3)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: AddAnnotationBitmap to page

AddAnnotationBitmap to page 3 years 3 months ago #6351

  • manderin87
  • manderin87's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
  • Karma: 0
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?
The administrator has disabled public write access.

AddAnnotationBitmap to page 3 years 3 months ago #6352

  • manderin87
  • manderin87's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
  • Karma: 0
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.
The administrator has disabled public write access.

AddAnnotationBitmap to page 3 years 3 months ago #6353

  • manderin87
  • manderin87's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
  • Karma: 0
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?
The administrator has disabled public write access.

AddAnnotationBitmap to page 3 years 3 months ago #6354

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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();
Last Edit: 3 years 3 months ago by .
The administrator has disabled public write access.

AddAnnotationBitmap to page 3 years 3 months ago #6355

  • manderin87
  • manderin87's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 21
  • Thank you received: 1
  • Karma: 0
What view class has the v functions (vGetPos, vGetX)?
The administrator has disabled public write access.

AddAnnotationBitmap to page 3 years 3 months ago #6356

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
these codes can be works in PDFReader class, which has m_view member.
The administrator has disabled public write access.
Powered by Kunena Forum