Class PdfFormScripts
The standard Acrobat form functions (AFNumber_, AFPercent_, AFDate_, AFTime_, AFSpecial_*, AFRange_Validate, AFSimple_Calculate and simplified field notation), recognised in a field's scripts and carried out natively. Document JavaScript is never executed: a script that is anything more than these calls is reported as unsupported.
public static class PdfFormScripts
- Inheritance
-
PdfFormScripts
- Inherited Members
Methods
Accept(PdfFieldBehavior, string)
A value typed into the field, checked as its keystroke and validate scripts would on commit: the value to store, or why it is refused.
public static (string? Value, string? Error) Accept(PdfFieldBehavior b, string input)
Parameters
bPdfFieldBehaviorinputstring
Returns
AllowsCharacter(PdfFieldBehavior, char)
Whether a character may be typed into the field (its keystroke script's rule).
public static bool AllowsCharacter(PdfFieldBehavior b, char c)
Parameters
bPdfFieldBehaviorcchar
Returns
Canonical(decimal)
A number as JavaScript would print it, but exact: no trailing zeros, no binary noise.
public static string Canonical(decimal d)
Parameters
ddecimal
Returns
Display(PdfFieldBehavior, string)
The field's value as it shows: formatted by its format script, or as it is.
public static PdfFieldDisplay Display(PdfFieldBehavior b, string value)
Parameters
bPdfFieldBehaviorvaluestring
Returns
FormatDate(DateTime, string)
public static string FormatDate(DateTime d, string pattern)
Parameters
Returns
FormatNumber(decimal, int, int)
public static string FormatNumber(decimal value, int decimals, int separatorStyle)
Parameters
Returns
ParseDate(string, string)
A date typed in any reasonable way, read in the order the pattern puts day, month and year (AFParseDateEx).
public static DateTime? ParseDate(string text, string pattern)
Parameters
Returns
ParseNumber(string, int)
A number as typed or stored: invariant first, then by the field's separator style (AFMakeNumber).
public static decimal? ParseNumber(string text, int separatorStyle = 0)
Parameters
Returns
Prepare(PdfAcroForm, IEnumerable<PdfFieldChange>)
The changes to write for what the user entered: each typed value checked by the field's keystroke and validate rules (a refusal throws), stored in its canonical form and shown through its format; then every calculated field recalculated, in calculation order, and formatted the same way. Fields whose scripts are custom code are filled as typed.
public static List<PdfFieldChange> Prepare(PdfAcroForm form, IEnumerable<PdfFieldChange> changes)
Parameters
formPdfAcroFormchangesIEnumerable<PdfFieldChange>
Returns
Read(PdfFormField)
public static PdfFieldBehavior Read(PdfFormField field)
Parameters
fieldPdfFormField
Returns
Recalculate(PdfAcroForm, IReadOnlyDictionary<string, string>)
Recalculates every calculated field in calculation order, each seeing the results of the ones before it. Returns the fields whose value changed, with the new value.
public static IReadOnlyList<(string Field, string Value)> Recalculate(PdfAcroForm form, IReadOnlyDictionary<string, string> values)
Parameters
formPdfAcroFormvaluesIReadOnlyDictionary<string, string>