FoxitPDFSDKforWeb  8.2.0
Foxit PDF SDK for Web
PDFForm Class Reference

Public Member Functions

 addControl (pageIndex, fieldName, fieldType, rect)
 Add a new form control to a specified form field. If the form field does not exist, this function will add a form field as well. (Not support signature field) More...
 
 addSignature (pageIndex, rect, fieldName)
 Add a unsigned signature. More...
 
 calculate (field)
 Calculate form fields' value. More...
 
 getField (title, wildcast=false)
 Get PDFField specified by title(a.k.a name). More...
 
 getFieldByIndex (index)
 Get PDFField specified by index. More...
 
 getFieldCount ()
 Get the count of form fields including unsupported signature. More...
 
 removeField (fieldName)
 Remove a form field. More...
 
 resetForm (fieldNames=[], flags=0, source)
 Reset form fields value to default value. More...
 

Detailed Description

PDF Form object

The PDF form module is a tree structure with the PDFForm as the root node, PDFField as the intermediate node and the Widget annotation (which called Form Control) as the leaf node.

Since
7.1.0

Member Function Documentation

◆ addControl()

PDFForm::addControl (   pageIndex,
  fieldName,
  fieldType,
  rect 
)
inline

Add a new form control to a specified form field. If the form field does not exist, this function will add a form field as well. (Not support signature field)

Parameters
pageIndex{number} - The page index, which starts from 0 as the first page.
fieldName{string} - The full field name. It should not be an empty string.
fieldType{number} - Field type. Please refer to Field_Type except Field_Type.Unknown and Field_Type.Sign.
rect{PDFRect} - Rectangle of the new form control which specifies the position in PDF page. It should be in [PDF coordinate system].
Returns
Promise.<{ success:boolean, - true means success, while false means failure. newFieldName:string - if the specified field name can not be used for a new field in specified field type, It will use a new field name for the specified field type. }>

◆ addSignature()

PDFForm::addSignature (   pageIndex,
  rect,
  fieldName 
)
inline

Add a unsigned signature.

Note
This function may be modified in the future.
Parameters
pageIndex{number} - Specify page index on which this signature will appear.
rect{PDFRect} - (Required if fieldName is absent)Position of signature.
fieldName{string} - The name of the signature field.
Returns
{Promise<PDFField>} A signature field.
Since
7.3.0

◆ calculate()

PDFForm::calculate (   field)
inline

Calculate form fields' value.

Parameters
field{PDFField} - Target field which to be setted.

◆ getField()

PDFForm::getField (   title,
  wildcast = false 
)
inline

Get PDFField specified by title(a.k.a name).

Parameters
title{string} - The title of field.
Returns
{PDFField[]} - Target field if existed.

◆ getFieldByIndex()

PDFForm::getFieldByIndex (   index)
inline

Get PDFField specified by index.

Parameters
index{number} - Specifies field index.
Returns
{PDFField} - Target field if existed.

◆ getFieldCount()

PDFForm::getFieldCount ( )
inline

Get the count of form fields including unsupported signature.

Returns
{number} - The count of fields.

◆ removeField()

PDFForm::removeField (   fieldName)
inline

Remove a form field.

Note
Using this function to remove may cause the index of field changed.

If the form field appears on more than one PDF page, all representations will be removed.

Parameters
fieldName{string} - A string value. It should not be an empty string.
Returns
{Promise.<bool>} true means success, while false means failure.

◆ resetForm()

PDFForm::resetForm (   fieldNames = [],
  flags = 0,
  source 
)
inline

Reset form fields value to default value.

Parameters
fieldNames{Array[string]} - Specifies target fields, could be empty.
flags{number} - Specifies reseting flags.Please refer to reference 1.7 Table 8.88.
source{PDFField} - Specifies source field which trigger this action. If pass Null to this, calulation will not be performed.

Foxit Software Corporation Logo
@2021 Foxit Software Incorporated. All rights reserved.