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

TOPIC:

AcroForms filling support 8 years 4 months ago #9896

  • inibg2
  • inibg2's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Hello, I have a requirement from a client where I have to fill with some data a PDF which is a Form and then display it into my app. I need this both for android and iOS. So far I managed myself to display a PDF using the library but I couldn't find any info about how to fill a form. Where can I find an example or documentation about this? am I able to do it with the Demo library?

Thank you!

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

AcroForms filling support 8 years 4 months ago #9900

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
yes you can do it with our library.
I suggest you to look at the documentation here: www.radaeepdf.com/documentation/javadocs/
You should look at the following methods:
  • SetEditText
  • SetComboItem
  • SetCheckValue

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

AcroForms filling support 8 years 4 months ago #9909

  • inibg2
  • inibg2's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Great! I'll take a look at that.
by the way, is there any method to flatten the document once I fill it?
Thank you!

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

AcroForms filling support 8 years 4 months ago #9911

  • inibg2
  • inibg2's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
I'm having some trouble with this, it seems that methods that are specified to be used with premium or professional license are not working with demo library, it's that correct? I know that I asked that before but I can't figure out why it's not working.

Thank you very much.

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

AcroForms filling support 8 years 4 months ago #9913

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
no, the demo library it's activated with a Premium license to show all the features available with it.

After calling the methods I suggested you, you should re-render page to display modified data.
As written here: www.radaeepdf.com/documentation/javadocs...xt(java.lang.String)

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

AcroForms filling support 8 years 4 months ago #9921

  • inibg2
  • inibg2's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 9
  • Thank you received: 0
Thanks for you patience.

I used that method you suggested but I'm not rendering the PDF, I'm filling it and saving it again, after it's saved I open it.
In execution time, I get the number of pages the document has, but the number of annotations it's always zero. The document can be filled using Acrobat reader DC without problem.
The code I have is the following:
private void FillPDF() {
		Log.d("GXC", "archivo a abrir: " + fileName);
		// obtengo el documento
		Global.Init(getActivity());

		m_doc = new Document();
		Integer ret = m_doc.Open(fileName, filePassword);
// Me quedo con el numero de paginas que tiene el documento
		int i = m_doc.GetPageCount();
		Page p;
		int currentPage;
		String property, value;
		Entity entity;
		Annotation an;
		// Recorro los diferentes valores
		Iterator<Entity> it = values.iterator();
       while (it.hasNext()) {
			entity = it.next();
			property = (String) entity.getProperty("Campo");
			value = (String) entity.getProperty("Valor");
			currentPage = 0;
			an = null;
			// Recorro las diferentes paginas
			while (currentPage < i) {
				
				Log.d("GXC", "property: " + property);
				p = m_doc.GetPage(0);
				p.ObjsStart();
				
				Log.d("GXC", "Arranco " + p.toString());
				Log.d("GXC", "cantidad de paginas: " + m_doc.GetPageCount());
				Log.d("GXC", "cantidad de anotaciones: " + p.GetAnnotCount());
				an = p.GetAnnotByName(property);
				if (an != null) {
					Log.d("GXC", "Encuentro y grabo el valor");
					an.SetEditText(value);
					break;
				} else
					Log.d("GXC", "no lo encontre al valor");
				currentPage++;
			}
		}
		boolean salvo = m_doc.Save();
        	m_doc.Close();
		Log.d("GXC", "se supone que salvo " + salvo);
	}

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

Powered by Kunena Forum