Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

How do I retrieve all the items in a drop down form field?

Question

I have a PDF form with a drop down list field that contains 3 items: Apple, Orange, Peach

How do I extract these three string values from this field using the Quick PDF library?

Answer

This code will display the "Exported Value" of all items available in Choice drop down combos. Currently there is no way to get the actual text displayed in the Combo. I will make a suggestion to the developers.

int ret = QP.LoadFromFile("applespearspeaches.pdf");
int fieldCount = QP.FormFieldCount();

for (int i = 1; i <= fieldCount; i++)
{
string title = QP.GetFormFieldTitle(i);
int type = QP.GetFormFieldType(i);

if (type == 5)  // Choice
{
int itemCount = QP.GetFormFieldSubCount(i);

for (int j = 1; j <= itemCount; j++)
{
string s = QP.GetFormFieldSubName(i, j);

MessageBox.Show(title + " : choice" + j.ToString() + " = " + s);
}
}
}

Here is the documentation for the functions I have used.


© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum