Hello,
I am trying to load Bitmap and Drawable contents over an annotation on a page.
For this, I first load a "classic" annotation zone with the function page.AddAnnotURI(), that I load in the file PDFReaderAct.java, precisely in the OnPageChanged(int pageno) method.
This works great but now I would like to add Bitmap and Drawable files over this kind of zone.
I checked these links on the forum but nothing resolved my problem yet:
How to add an image to a pdf? (Android)
NPE in annotation.setIcon(String, PageContent)
Bitmap Annotations does not show image
This works great:
page.ObjsStart();
page.AddAnnotURI(rect, function);
m_view.vRenderAsync(m_vpage);
But this doesn't display my Bitmap:
page.ObjsStart();
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.my_drawable);
PageContent pageContent = new PageContent();
pageContent.Create();
pageContent.GSSave();
com.radaee.pdf.Matrix mat = new com.radaee.pdf.Matrix(rect[0], rect[1], rect[2], rect[3]);
pageContent.GSSetMatrix(mat);
mat.Destroy();
Document.DocImage docimage = m_doc.NewImage(bitmap, false);
page.AddAnnotBitmap(bitmap, false, rect);
//Page.ResImage rimage = page.AddResImage(docimage);
//pageContent.DrawImage(rimage);
pageContent.GSRestore();
pageContent.Destroy();
page.Close();
m_view.vRenderAsync(m_vpage);
I put comments on the Page.ResImage lines: it crashes because
docimage is null, so maybe the problem is here?
Even if I save the document after, the pictures are not displayed.
License Type: RadaeePDF Professional
SDK Version: 3.1