FoxitPDFSDKforWeb  v10.0.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, options)
 Add an 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=null)
 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
pageIndexnumber - The page index, which starts from 0 as the first page.
fieldNamestring - The full field name. It should not be an empty string.
fieldTypenumber - Field type. Please refer to Field_Type except Field_Type.Unknown and Field_Type.Sign.
rectPDFRect - Rectangle of the new form control which specifies the position in PDF page. It should be in [PDF coordinate system].
Returns
Promise<{success:boolean,newFieldName:string}> -
{
success: boolean, // <b>true</b> means success, while <b>false</b> 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,
  options 
)
inline

Add an unsigned signature.

Note
This function may be modified in the future.
Parameters
pageIndexnumber - Specify page index on which this signature will appear.
rectPDFRect - (Required if fieldName is absent)Position of signature.
fieldNamestring - 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
fieldPDFField - Target field which to be setted.

◆ getField()

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

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

Parameters
titlestring - The title of field.
Returns
PDFField[] - Target field if existed.

◆ getFieldByIndex()

PDFForm::getFieldByIndex (   index)
inline

Get PDFField specified by index.

Parameters
indexnumber - 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
fieldNamestring - A string value. It should not be an empty string.
Returns
Promise<boolean> - true means success, while false means failure.

◆ resetForm()

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

Reset form fields value to default value.

Parameters
fieldNamesstring[] - Specifies target fields, could be empty.
flagsnumber - Specifies reseting flags.Please refer to reference 1.7 Table 8.88.
sourcePDFField - Specifies source field which trigger this action. If pass Null to this, calulation will not be performed.

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