- Posts: 21
- Thank you received: 1
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
AddAnnotationBitmap to page
- manderin87
- Topic Author
- Offline
- Junior Member
-
Less
More
IP: 192.168.0.71
12 years 3 months ago #6351
by manderin87
AddAnnotationBitmap to page was created by manderin87
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?
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?
- manderin87
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 1
IP: 192.168.0.71
12 years 3 months ago #6352
by manderin87
Replied by manderin87 on topic AddAnnotationBitmap to page
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.
- manderin87
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 1
IP: 192.168.0.71
12 years 3 months ago #6353
by manderin87
Replied by manderin87 on topic AddAnnotationBitmap to page
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?
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?
IP: 192.168.0.71
12 years 3 months ago - 12 years 3 months ago #6354
by radaee
Replied by radaee on topic AddAnnotationBitmap to page
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();
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: 12 years 3 months ago by .
- manderin87
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 1
IP: 192.168.0.71
12 years 3 months ago #6355
by manderin87
Replied by manderin87 on topic AddAnnotationBitmap to page
What view class has the v functions (vGetPos, vGetX)?
IP: 192.168.0.71
12 years 3 months ago #6356
by radaee
Replied by radaee on topic AddAnnotationBitmap to page
these codes can be works in PDFReader class, which has m_view member.
Time to create page: 0.620 seconds