- Posts: 1
- 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 iOS development and PDF
Getting export value from a choice field in a PDF
IP: 24.79.70.242
6 years 7 months ago #14469
by fuelware
The attached form contains a number of drop-downs that are used in calculations. The user is able to choose frequency and impact which are mapped to a number using the export value of the dropdown.
The library doesn't seem to directly provide both values from an entry in the Opt array where the entry is a two-item array instead of just a text string so I'm using the code below to get the export value instead of the label (where it exists); annot is the PDFAnnot object and inDoc the PDFDoc object that holds it:
This gets the export value for these fields in the attached PDF:
impact_row5.0 through impact_row5.5
frequency_row5.0 through frequency_row5.5
frequency_row1.0 through frequency_row1.3
However when used on fields post_freq_1, post_impact_1, post_freq_2.0 through post_freq_2.8 and post_imp_2.0 through post_imp_2.8 the value for optArray is a zero-length array (when it should be a 6 item array). The Opt array for those controls is an indirect reference; when I manually request the object using its reference number and inDoc.advanceGetObj() (226 0 and 229 0 for the post_freq_2.x and post_imp_2.x respectively) I get the appropriate array. However optArray has a type of 6 (=> array?) and no indirect reference. Am I trying to retrieve this incorrectly and is there a better way to do it? Thanks.
Getting export value from a choice field in a PDF was created by fuelware
Attachment not found
The attached form contains a number of drop-downs that are used in calculations. The user is able to choose frequency and impact which are mapped to a number using the export value of the dropdown.
The library doesn't seem to directly provide both values from an entry in the Opt array where the entry is a two-item array instead of just a text string so I'm using the code below to get the export value instead of the label (where it exists); annot is the PDFAnnot object and inDoc the PDFDoc object that holds it:
Code:
if annot.getComboSel() < annot.getComboItemCount() {
//see if there are export values; if so use them
let obj = inDoc.advanceGetObj(annot.advanceGetRef())
obj?.setDictionary()
let optArray = obj?.dictGetItem(byTag: "Opt")
optArray?.setArray()
if
let optCount = optArray?.arrayGetItemCount(),
optCount > annot.getComboSel(),
let selectedItem = optArray?.arrayGetItem(annot.getComboSel() ),
selectedItem.getType() == 6 //array
{
selectedItem.setArray()
if let exportValue = selectedItem.arrayGetItem(0)?.getNameVal() {
return exportValue as AnyObject
}
}
if let txt = annot.getComboItem(annot.getComboSel()) {
return txt as AnyObject
} else {
return "" as AnyObject
}
}
impact_row5.0 through impact_row5.5
frequency_row5.0 through frequency_row5.5
frequency_row1.0 through frequency_row1.3
However when used on fields post_freq_1, post_impact_1, post_freq_2.0 through post_freq_2.8 and post_imp_2.0 through post_imp_2.8 the value for optArray is a zero-length array (when it should be a 6 item array). The Opt array for those controls is an indirect reference; when I manually request the object using its reference number and inDoc.advanceGetObj() (226 0 and 229 0 for the post_freq_2.x and post_imp_2.x respectively) I get the appropriate array. However optArray has a type of 6 (=> array?) and no indirect reference. Am I trying to retrieve this incorrectly and is there a better way to do it? Thanks.
IP: 212.97.62.176
6 years 7 months ago #14480
by emanuele
Replied by emanuele on topic Getting export value from a choice field in a PDF
Dear user,
sorry for the delay, we are deeply checking your request and the JS used on your pdf file.
Currently, the combo box exposed methods are getComboSel, getComboItem and getComboItemCount.
We are working to give you a complete answer and methods to help you to handle these annotations easily.
sorry for the delay, we are deeply checking your request and the JS used on your pdf file.
Currently, the combo box exposed methods are getComboSel, getComboItem and getComboItemCount.
We are working to give you a complete answer and methods to help you to handle these annotations easily.
IP: 212.97.62.176
6 years 7 months ago #14481
by emanuele
Replied by emanuele on topic Getting export value from a choice field in a PDF
Dear user,
you could download the new Swift module version, that now includes getComboItemVal to get the export value of the annotation.
In this case you could use this new method instead of the advanced methods.
You could find the new project here: www.radaeepdf.com/download/file/140-radaeepdfswift-1-1-7
The changed files are:
- libRDPDFLib.a
- PDFIOS.h
- PDFObjc.h/m
- PDFLayoutView.m
you could download the new Swift module version, that now includes getComboItemVal to get the export value of the annotation.
In this case you could use this new method instead of the advanced methods.
You could find the new project here: www.radaeepdf.com/download/file/140-radaeepdfswift-1-1-7
The changed files are:
- libRDPDFLib.a
- PDFIOS.h
- PDFObjc.h/m
- PDFLayoutView.m
Time to create page: 0.396 seconds