- Posts: 21
- 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
Extracting fields and Checkbox Tick Mark
- sharikakanakam
- Topic Author
- Offline
- Junior Member
-
Less
More
9 years 11 months ago #10432
by sharikakanakam
Extracting fields and Checkbox Tick Mark was created by sharikakanakam
Hi there,
We have a requirement in our company to show a pdf downloaded from the server to the user of our android app and then allow them to eidt and save the fields. So when the user navigates away from the pdf screen, I would like to loop through all the fields and get the field names and values of those fields to be saved into our app. Now I have created a test app using your pdf sdk and Im able to see the pdf and edit it. So my questions are :
1. I need to detect each field. So that I can turn on each feature like 'ink' for a 'signature' field. How to achieve this?
2. I saw that the checkbox in my pdf gets highlighted when I select it rather than displaying a 'tick'. I would like to show a 'tick' as expected when user selects a checkbox. Now its only getting highlighted. How to achieve this?
3. How to loop through all fields so that I can save the values the user has entered when I navigate away from the pdf?
Also please let me know if I would need a premium version to achieve any of the above?
We have a requirement in our company to show a pdf downloaded from the server to the user of our android app and then allow them to eidt and save the fields. So when the user navigates away from the pdf screen, I would like to loop through all the fields and get the field names and values of those fields to be saved into our app. Now I have created a test app using your pdf sdk and Im able to see the pdf and edit it. So my questions are :
1. I need to detect each field. So that I can turn on each feature like 'ink' for a 'signature' field. How to achieve this?
2. I saw that the checkbox in my pdf gets highlighted when I select it rather than displaying a 'tick'. I would like to show a 'tick' as expected when user selects a checkbox. Now its only getting highlighted. How to achieve this?
3. How to loop through all fields so that I can save the values the user has entered when I navigate away from the pdf?
Also please let me know if I would need a premium version to achieve any of the above?
9 years 11 months ago #10434
by Davide
Replied by Davide on topic Extracting fields and Checkbox Tick Mark
Hi,
1. to detect each field you can loop all the annotations and check the type using the following methods:
For more info check this:
www.radaeepdf.com/documentation/javadocs...ation.html#GetType--
To get annotation field type in acroForm you need this method valid in premium version.
For more info check this:
www.radaeepdf.com/documentation/javadocs....html#GetFieldType--
2. After the tap you need to click the "Do Button" (PDFReader module) or the "Play icon" (RDPDFReader module) to display the tick and perform the annot.
I suggest you to look at PDFPerformAnnot method of PDFReader class to understand how it works.
You probably need :
To use this method you need a premium license: www.radaeepdf.com/documentation/javadocs...tCheckValue-boolean-
3. To save all the pdf edits you have to call:
1. to detect each field you can loop all the annotations and check the type using the following methods:
Code:
m_annot.GetType();
To get annotation field type in acroForm you need this method valid in premium version.
Code:
m_annot.GetFieldType()
2. After the tap you need to click the "Do Button" (PDFReader module) or the "Play icon" (RDPDFReader module) to display the tick and perform the annot.
I suggest you to look at PDFPerformAnnot method of PDFReader class to understand how it works.
You probably need :
Code:
m_annot.SetCheckValue(boolean check)
To use this method you need a premium license: www.radaeepdf.com/documentation/javadocs...tCheckValue-boolean-
3. To save all the pdf edits you have to call:
Code:
m_doc.Save();
- sharikakanakam
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 0
9 years 11 months ago #10440
by sharikakanakam
Replied by sharikakanakam on topic Extracting fields and Checkbox Tick Mark
Thanks for your help. I was able to detect the fields and get the checkbox working. But I have an issue with the signature field. I have a field in my pdf where user can sign and save. I need to detect this so that I can enable 'ink' programmatically when user is on the signature field. But the 'field.GetType' is not even detecting my 'signature' field. I can see all the text fields coming up while looping through page.GetAnnot(index)., but not the signature one. Can you please help?
9 years 11 months ago #10441
by Davide
Replied by Davide on topic Extracting fields and Checkbox Tick Mark
Hi,
please try with
According to this www.radaeepdf.com/documentation/javadocs....html#GetFieldType--
If this method returns 4 it is a signature field..
please try with
Code:
field.GetFieldType();
According to this www.radaeepdf.com/documentation/javadocs....html#GetFieldType--
If this method returns 4 it is a signature field..
public final int GetFieldType()
get annotation field type in acroForm.
this method valid in premium version
Returns:
type as these values:
0: unknown
1: button field
2: text field
3: choice field
4: signature field
- sharikakanakam
- Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 21
- Thank you received: 0
9 years 11 months ago #10442
by sharikakanakam
Replied by sharikakanakam on topic Extracting fields and Checkbox Tick Mark
I will make my question more clear. The pdf sdk is not able to detect the signature field in the pdf while looping htorugh the annotations. It can detect all other fields, but not signature. I mean, while looping using :
for(int pageno = 0; pageno < m_doc.GetPageCount(); pageno++) {
for (int index = 0; index < page.GetAnnotCount(); index++) {
Annotation annot = page.GetAnnot(index);
if(("$"+annot.GetFieldName()).equalsIgnoreCase("Signature")){
Log.e("Signature", "Signature field exists");
}
This code never enters the last if loop. That means the sdk is not even recognizing that there is a field on the signature. I hope you understand. Please let me know if you need anything else to help me fix this issue.
for(int pageno = 0; pageno < m_doc.GetPageCount(); pageno++) {
for (int index = 0; index < page.GetAnnotCount(); index++) {
Annotation annot = page.GetAnnot(index);
if(("$"+annot.GetFieldName()).equalsIgnoreCase("Signature")){
Log.e("Signature", "Signature field exists");
}
This code never enters the last if loop. That means the sdk is not even recognizing that there is a field on the signature. I hope you understand. Please let me know if you need anything else to help me fix this issue.
Time to create page: 0.390 seconds