Copy link to clipboard
Copied
i make a secuired pdf file and want to let the company to add the pilot names as (values) and their IDs as (items) in the dropdown list, without reaching to my script.
i use this script:
function PopulateCabinCrewCode()
{ for (var i=10; i<20; i++) { this.getField("code" + i).setItems([
["", ""],
["41", "I.Amer "],
["46", "M.Mokhtar"]
]); } }
thanks in advance.
Copy link to clipboard
Copied
Read this article and download the example script:
https://acrobatusers.com/tutorials/list_and_combo_in_lc/
While the article is about copying data between lists. It shows how individual items can be added and removed from a list.
You'll find general information about scripting lists here:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
And another list programming sample here:
https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
You can place items and values in a CSV file placed as an attachment in the PDF.
So your client just need to edit/replace the CSV file to update the dropdown.
Acrobate du PDF, InDesigner et Photoshopographe
Copy link to clipboard
Copied
how to make CSV file placed as an attachment in the PDF ?
Copy link to clipboard
Copied
Hi,
A CSV file is just a file which contains items seperated by comma (or tabs) and each row is an entry
firstname, secondname
Bob, Marley,
Frank, Beard,
And you can attach it to a PDF searching for attach. and selecting "Attach File"
Then you would need to change your code to read the values from the CSV File.
You can get all attachements using
//taken from AcrobatDC_js_api_reference.pdf
var d = this.dataObjects;
for (var i = 0; i < d.length; i++)
console.println("Data Object[" + i + "]=" + d[i].name);
Copy link to clipboard
Copied
Read this article and download the example script:
https://acrobatusers.com/tutorials/list_and_combo_in_lc/
While the article is about copying data between lists. It shows how individual items can be added and removed from a list.
You'll find general information about scripting lists here:
https://www.pdfscripting.com/public/List-Field-Usage-and-Handling.cfm
And another list programming sample here:
https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm
Use the Acrobat JavaScript Reference early and often

