Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

custom annotation icon 5 years 10 months ago #13904

  • vitdos1
  • vitdos1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
hello. i want to set custom annotation icon. i use this code:

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();
}

but i have problem with this line: ResImage rimg = form.AddResImage(dimg);
I got rimg = null and icon doesnt change.

method AddResImage(dimg) is:
public ResImage AddResImage(Document.DocImage dimg)
{
if(dimg == null) return null;
long ret = addFormResImage(m_doc.hand_val, hand, dimg.hand);
if(ret == 0) return null;
ResImage res_img = new ResImage();
res_img.hand = ret;
return res_img;
}
and native method addFormResImage(m_doc.hand_val, hand, dimg.hand) return 0.

What are the reasons for this?

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

Last edit: by vitdos1.

costom annotation icon 5 years 10 months ago #13906

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
what kind of license do you have?
To use these methods you need a premium license as written here : www.radaeepdf.com/documentation/javadocs...f.Document.DocImage-

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

costom annotation icon 5 years 10 months ago #13910

  • vitdos1
  • vitdos1's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0

Hi,
what kind of license do you have?
To use these methods you need a premium license as written here : www.radaeepdf.com/documentation/javadocs...f.Document.DocImage-

Thanks, I have professional licence. do I have another way to set custom icon?

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

costom annotation icon 5 years 10 months ago #13911

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
with your professional license you can set one of the default icon using the following method : www.radaeepdf.com/documentation/javadocs...on.html#SetIcon-int-

To set custom icon you need a Premium license.

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

  • Page:
  • 1
Powered by Kunena Forum