- Posts: 7
- Thank you received: 0
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
custom annotation icon
IP: 91.215.176.177
7 years 8 months ago - 7 years 8 months ago #13904
by vitdos1
custom annotation icon was created by vitdos1
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?
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?
Last edit: 7 years 8 months ago by vitdos1.
IP: 37.183.44.177
7 years 8 months ago #13906
by Davide
Replied by Davide on topic costom annotation icon
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-
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-
IP: 91.215.176.177
7 years 8 months ago #13910
by vitdos1
Replied by vitdos1 on topic costom annotation icon
Thanks, I have professional licence. do I have another way to set custom icon?Davide wrote: 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-
IP: 37.183.44.177
7 years 8 months ago #13911
by Davide
Replied by Davide on topic costom annotation icon
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.
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.
Time to create page: 0.517 seconds