05.01.2013 Views

Debenu Quick PDF Library 9 Developer Guide

Debenu Quick PDF Library 9 Developer Guide

Debenu Quick PDF Library 9 Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PDF</strong> Forms<br />

An interactive form -- sometimes referred to as an AcroForm -- is a collection of fields for<br />

gathering information interactively from the user. A <strong>PDF</strong> document may contain any number of<br />

fields appearing on any combination of pages, all of which make up a single, global interactive<br />

form spanning the entire document.<br />

<strong>Debenu</strong> <strong>Quick</strong> <strong>PDF</strong> <strong>Library</strong> provides fully support for working with form fields in <strong>PDF</strong> files, from<br />

adding new form fields to retrieving data from form fields to updating existing form fields with<br />

new data.<br />

Form Field Types<br />

<strong>PDF</strong> forms support the following field types:<br />

● Button fields represent interactive controls on the screen that the user can manipulate<br />

with the mouse. They include pushbuttons, check boxes, and radio buttons.<br />

● Text fields are boxes or spaces in which the user can enter text from the keyboard.<br />

● Choice fields contain several text items, at most one of which may be selected as the<br />

field value. They include scrollable list boxes and combo boxes.<br />

● Signature fields represent digital signatures and optional data for authenticating the<br />

name of the signer and the document’s contents.<br />

The GetFormFieldType function can be used to determine which form field type your fields are.<br />

Create a new simple <strong>PDF</strong> form<br />

<strong>Debenu</strong> <strong>Quick</strong> <strong>PDF</strong> <strong>Library</strong> lets you create new <strong>PDF</strong> forms from scratch. In this example we’ll<br />

create four new text form fields with varying characteristics.<br />

/* Create a <strong>PDF</strong> form */<br />

// Tell the library that all co-ordinates should<br />

// begin from the top left corner of the page.<br />

QP.SetOrigin(1);<br />

// Add the first new form field<br />

var iDf1 = QP.NewFormField("First Name", 1);<br />

QP.SetFormFieldValue(iDf1, "Jane");<br />

QP.SetNeedAppearances(1);<br />

QP.SetFormFieldBounds(iDf1, 20, 20, 100, 20);<br />

QP.SetFormFieldAlignment(iDf1, 2);<br />

// Add the second new form field<br />

var iDf2 = QP.NewFormField("Second Name", 1);<br />

QP.SetFormFieldValue(iDf2, "Doe");<br />

QP.SetNeedAppearances(1);<br />

QP.SetFormFieldBounds(iDf2, 20, 50, 100, 20);<br />

fID = QP.AddTrueTypeFont("Myriad Pro Cond", 1);<br />

ffID = QP.AddFormFont(fID);<br />

QP.SetFormFieldFont(iDf2, ffID);<br />

// Add the third new form field<br />

var iDf3 = QP.NewFormField("Age", 1);<br />

QP.SetFormFieldValue(iDf3, "31");

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!