Working with PDF forms and PDFNet

Q: I have attached 2 PDF documents. The first one (form1.pdf), comes
from your web site. I am somewhat concerned that the form is so
simple, and all it contains is some non-smart fields. Compare with the
second PDF file. Notice how clicking on the “YES” “NO” triggers the
enabling and disabling of the following lines. Can PDFTron do that?

We need to add fillable fields, JavaScripts, calculations and
annotations to our forms.
In short: everything that can be done with Acrobat Professional, we
would like to do
programmatically with your library. At this point we are focusing only
on the traditional
AcroForms (not on XFA).

The second question is about your form1.pdf file. I assume the fields
were added by
PDFTron, but what about the fields’ precise positioning? Did you have
to painfully
measure the document in order to determine its coordinates, or is
there some way to
automagically place the fields in the correct spots?


A: There is no specific reason why the sample form is so simple. Most
likely the form was simplified to bare essentials to illustrate the
basic functionality. Still you can use the same approach on PDFs with
arbitrary complexity. Regarding dynamic behavior it can be implemented
by embedding JavaScript code snippets and associating form fields with
JavaScript actions. I believe that PDFNet Knowledge Base contains some
code snippets showing how to embed JavaScript (or other content), but
in case you have trouble with the implementation we can definitely
assist you. So, in short, PDFNet does not have any specific
limitations when it comes to AcroForms and you can build/process/
extract any conceivable PDF form.
Regarding your second question, it really depends on your
requirements. One possibility (e.g. used in Acrobat Pro) is to ‘draw’
form fields on top of the existing PDF document. The PDF template can
be authored using any PDF creation application (including PDFNet SDK
creation API). PDFNet SDK offers a built-in PDF viewer and it is
possible to create custom tools that would mimic Acrobat Pro tools
related to form creation. In case you need more automatic way to
define form regions, you would need to analyze the contents of PDF
document and apply specific rules depending on the content and the
positioning information. Because PDFNet offers full content extraction
API (please see ElementReaderAdv and TextExtract samples) it is also
possible to implement this type of automatic