How do I get properties from the PDF form fields?

Q: I need to get some properties from the PDF’s fields.

The properties that we need are

FieldLabel

Description

ToolTip

FontName

TextColor

BackgroundColor

BorderColor

BorderStyleID

Calculation

VisibilityTypeID

ReadOnlyID

FormatMask

MaxCharLength

Action

ActionTypeID

But

The most important fields to verify are:

BackgroundColor

BorderColor

BorderStyleID

I am reading PDFNet API Ref documentation but I could not find how to do that

A: Where are names of these properties coming from? They don’t seem to be from PDF spec.

You can extract all of the filed attributes via Field and Widget class:

http://www.pdftron.com/pdfnet/html/classpdftron_1_1PDF_1_1Field.html

http://www.pdftron.com/pdfnet/html/classpdftron_1_1PDF_1_1Annots_1_1Widget.html

As a starting point please take a look at InteractiveForms and Annotation sample projects.

http://www.pdftron.com/pdfnet/samplecode.html#InteractiveForms

http://www.pdftron.com/pdfnet/samplecode.html#Annotation

You can create a Widget out of a filed with a simple cast:

// C#

Widget w = new Widget(field.GetSDFObj());
if (w.IsValid()) {
… w.GetBorderStyle()…
}

For more info/examples please search this forum.