Knowledge Base - Set custom annotation icon

Below you can find an example on how to set customized icon for sticky text note/file attachment annotation

Page mPage = m_doc.GetPage(m_pageno);
if (mPage != null) {
mPage.ObjsStart();

Annotation annotation = mPage.GetAnnot(mPage.GetAnnotCount() - 1);
if (annotation != null) {
Document.DocForm form = m_doc.NewForm();
PageContent content = new PageContent();
content.Create();

Bitmap icon = BitmapFactory.decodeResource(getContext().getResources(), R.drawable.pdf_custom_stamp);

Document.DocImage dimg = m_doc.NewImage(icon, true);
ResImage rimg = form.AddResImage(dimg);
Matrix mat = new Matrix( 20, 20, 0, 0 );
content.GSSetMatrix(mat);
mat.Destroy();
content.DrawImage(rimg);
content.GSRestore();

form.SetContent(content, 0, 0, 20, 20);

boolean success = annotation.SetIcon("MyIcon", form);

icon.recycle();
content.Destroy();
}
mPage.Close();
}
Applies To

RadaeePDF SDK for Android

Details

Created : 2016-12-12 11:06:11, Last Modified : 2018-01-10 08:50:20