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

TOPIC:

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15045

  • Righetti
  • Righetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
Is it possible to add annotations like checkbox combo etc at runtime ?

Thanks in advance

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

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15046

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
it is form field creating feature.
available some special version like:
www.radaeepdf.com/download/download-prev...daeepdf-4-00-preview
and
www.radaeepdf.com/download/download/file/82-server-java

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

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15051

  • Righetti
  • Righetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I include this preview lib, there are many changes to do, but when I run my App and try to get out the "label" of checkbox , using my function :

public static String getButtonLabel(Document document, Page.Annotation annotation)
{
// *** obj.DictGetItem("AP").DictGetItem("D").DictGetItemTag(1) "Si"

String key = null;

Obj obj = document.Advance_GetObj(annotation.Advance_GetRef());

if (obj != null)
{
Obj dict_AP = obj.DictGetItem("AP");

if (dict_AP != null)
{
Obj dict_N = dict_AP.DictGetItem("N");

for (int i = 0; dict_N != null && i < dict_N.DictGetItemCount(); i++)
{
key = dict_N.DictGetItemTag(i);

if (key != null && key.equalsIgnoreCase("Off") == false)
break;
}
}
}

return key;
}

... sometimes when I call "dict_N.DictGetItemTag(i);" the app crash with the attach exception.

Thanks in advance

Tommaso.
Attachments:

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

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15052

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
do not coding by yourself, there is an exist example.
plz see function com.radaee.reader.PDFTextAct.NewFields():
	private void NewFields(int pageno)
	{
		Page page = m_doc.GetPage(pageno);
		DocFont dfont = m_doc.NewFontCID("Times", 8);//embed in horizontal writing
		ResFont rfont = page.AddResFont(dfont);

		PageContent content = new PageContent();
		content.Create();
		content.SetFillColor(0);

		page.ObjsStart();
		float rect[] = new float[4];
		float font_size = 20;
		float box_size = 20;
		float text_gap = 5;

		//2 radiobox for male/female.
		rect[0] = 20;
		rect[1] = 630;
		rect[2] = rect[0] + box_size;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0] + box_size + text_gap, rect[1] + font_size * 0.15f);
		content.DrawText("Male");
		content.TextEnd();
		page.AddFieldRadio(rect, "radsex", "Male", null, null);
		rect[0] = 100;
		rect[1] = 630;
		rect[2] = rect[0] + box_size;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0] + box_size + text_gap, rect[1] + font_size * 0.15f);
		content.DrawText("Female");
		content.TextEnd();
		page.AddFieldRadio(rect, "radsex", "Female", null, null);

		//checkbox for married.
		rect[0] = 20;
		rect[1] = 600;
		rect[2] = rect[0] + box_size;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0] + box_size + text_gap, rect[1] + font_size * 0.15f);
		content.DrawText("Is married?");
		content.TextEnd();
		page.AddFieldCheck(rect, "chk1", "Married", null, null);

		//checkbox for parents.
		rect[0] = 20;
		rect[1] = 570;
		rect[2] = rect[0] + box_size;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0] + box_size + text_gap, rect[1] + font_size * 0.15f);
		content.DrawText("Has children?");
		content.TextEnd();
		page.AddFieldCheck(rect, "chk2", "Children", null, null);

		//input textbox.
		rect[0] = 20;
		rect[1] = 540;
		rect[2] = rect[0] + 200;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0], rect[1] + font_size * 0.15f);
		content.DrawText("Address:");
		content.TextEnd();
		float tsize[] = content.TextGetSize(rfont, "Address:", font_size, font_size, 0, 0);
		rect[0] += tsize[0] + text_gap;
		rect[2] = rect[0] + 200;
		page.AddFieldEditbox(rect, "txt1", false, false);

		//combo-box.
		rect[0] = 20;
		rect[1] = 510;
		rect[2] = rect[0] + 200;
		rect[3] = rect[1] + box_size;
		content.TextBegin();
		content.TextSetFont(rfont, font_size);
		content.TextMove(rect[0], rect[1] + font_size * 0.15f);
		content.DrawText("Country:");
		content.TextEnd();
		tsize = content.TextGetSize(rfont, "Country:", font_size, font_size, 0, 0);
		rect[0] += tsize[0] + text_gap;
		rect[2] = rect[0] + 100;
		page.AddFieldCombo(rect, "Country", new String[]{"England", "Italy", "American", "Japan"});

		page.AddContent(content, true);
		content.Destroy();
		page.Close();
	}
the label using page content to display texts.

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

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15054

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
about the crash:
you donwloaded version may the last version.
this sepcial version may not updated for long time.
plz contact our support.

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

Last edit: by radaee.

Add Annotations checkBox, Combo etc. to PDF 3 years 10 months ago #15055

  • Righetti
  • Righetti's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 15
  • Thank you received: 0
I remember that I opened a ticket for fix this error with the normal release, and you fix it.

The special version is only a test or will be released in the future? I need to know for implementing special functions in my app

Thanks

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

  • Page:
  • 1
  • 2
Powered by Kunena Forum