Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0   13.1   13.2    Statistic    FMM    Blog  

DynaPDF.GetPageField

Returns the most important properties of a field on a page.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 13.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.GetPageField"; PDF; Field; Selector )   More

Parameters

Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Field The field index within the page.
Zero based and up to DynaPDF.GetPageFieldCount-1.
$index
Selector What value to query.
Can be Deleted, BBox, FieldType, GroupType, Handle, BackColor, BackColorSP, BorderColor, BorderColorSP, BorderStyle, BorderWidth, CharSpacing, Checked, CheckBoxChar, DefState, DefValue, EditFont, ExpValueCount, BorderColor, FieldFlags, FieldFont, FontSize, FieldName, HighlightMode, IsCalcField, MapName, MaxLen, KidCount, PageNum, Rotate, TextAlign, TextColor, TextColorSP, TextScaling, ToolTip, UniqueName, Value, WordSpacing, Parent or Kids.

Added ModDate, CaptionPos, DownCaption, DownImage, RollCaption, RollImage, UpCaption, UpImage, Action and ActionType for version 9.0.
"Name"

Result

Returns OK or error.

Description

Returns the most important properties of a field on a page.
You need to call DynaPDF.EditPage before to open a page.

See also GetPageField function in DynaPDF manual.

Examples

Sets a text field and flatterns it

# Gets passed PDF number, field name, value and an action (Flatten or empty)
#
# Get variables
Set Variable [ $pdf ; Value: GetValue ( Get ( ScriptParameter ) ; 1 ) ]
Set Variable [ $fieldname ; Value: GetValue ( Get ( ScriptParameter ) ; 2 ) ]
Set Variable [ $value ; Value: GetValue ( Get ( ScriptParameter ) ; 3 ) ]
Set Variable [ $action ; Value: GetValue ( Get ( ScriptParameter ) ; 4 ) ]
#
# Set text for the field
Set Variable [ $SetError ; Value: MBS( "DynaPDF.SetTextFieldValueEx" ; $pdf; $fieldname; $value ) ]
If [ $action = "Flatten" ]
    # query, which page the field is on, so we can edit that page, required for drawing
    Set Variable [ $page ; Value: MBS( "DynaPDF.GetField"; $pdf; $fieldname; "page") ]
    If [ $page > 0 ]
        Set Variable [ $EditError ; Value: MBS( "DynaPDF.EditPage"; $pdf; $page) ]
        If [ $EditError = "OK" ]
            # We loop over the fields on the page to find the right one
            Set Variable [ $PageFieldCount ; Value: MBS( "DynaPDF.GetPageFieldCount"; $pdf ) ]
            Set Variable [ $PageFieldIndex ; Value: 0 ]
            Set Variable [ $found ; Value: 0 ]
            If [ $PageFieldIndex < $PageFieldCount ]
                Loop
                    # check name
                    Set Variable [ $Name ; Value: MBS( "DynaPDF.GetPageField"; $pdf; $PageFieldIndex; "name" ) ]
                    If [ $Name = $fieldname ]
                    # found the field to flatten
                    Set Variable [ $FlattenError ; Value: MBS("DynaPDF.FlattenAnnotOrField"; $pdf; $PageFieldIndex) ]
                    Set Variable [ $found ; Value: 1 ]
                    Exit Loop If [ 1 ]
                    End If
                    #
                    # next
                    Set Variable [ $PageFieldIndex ; Value: $PageFieldIndex + 1 ]
                    Exit Loop If [ $PageFieldIndex ≥ $PageFieldCount ]
                End Loop
            End If
            Set Variable [ $r ; Value: MBS( "DynaPDF.EndPage"; $PDF; $page) ]
            If [ not $found ]
                Exit Script [ Text Result: "Field not found!" ]
            Else
                Exit Script [ Text Result: $FlattenError ]
            End If
        Else
            Exit Script [ Text Result: $EditError ]
        End If
    End If
End If
Exit Script [ Text Result: $SetError ]

See also

Release notes

Blog Entries

This function checks for a paid license.

Created 18th November 2022, last changed 18th November 2022


DynaPDF.GetPageCount - DynaPDF.GetPageFieldAnnotation

💬 Ask a question or report a problem


Start Chat