DynaPDF.GetFieldsAsJSON
-----------------------

Queries all form fields as JSON array.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [10.5](newinversion105.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.GetFieldsAsJSON"; PDF { ; Flags } ) 

**MBS**( **"DynaPDF.GetFieldsAsJSON";** /\* Queries all form fields as JSON array. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Flags**) /\* Optional; Pass value for combination of flags you need.  
Add 1 to get flat list instead of fields and children as items within the parent field.  
Add 2 to include font information for field and edit fonts.  
Add 4 to include font buffer data.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Flags | Pass value for combination of flags you need.   Add 1 to get flat list instead of fields and children as items within the parent field.   Add 2 to include font information for field and edit fonts.   Add 4 to include font buffer data. | 0 | Optional |

### Result

Returns JSON or error.

### Description

Queries all form fields as JSON array.  
See TPDFFieldEx structure in DynaPDF help, which we convert to JSON for you.  
  
Keys include Deleted, BBox, FieldType, GroupType, Handle, BackColor, BackColorSP, BorderColor, BorderColorSP, BorderStyle, BorderWidth, CharSpacing, Checked, CheckBoxChar, DefState, Description, EditFont, ExpValCount, ExpValue, FieldFlags, FieldFont, FontSize, FieldName, HighlightMode, IsCalcField, MapName, MaxLen, ChildrenCount, Children, Parent, PageNum, Rotate, TextAlign, TextColor, TextColorSP, TextScaling, ToolTip, UniqueName, Value, WordSpacing, PageIndex, Barcode, Signature, ModDate, CaptionPos, DownCaption, DownImage, RollCaption, RollImage, UpCaption, UpImage, OC, Action, Action and Events.  
  
Added FullyQualifiedFieldName as field for v14.0.  
  
The description for a signature field includes the signature dictionary with the metadata for the signature like the certificate, the name, the contact info and the reason. You can take the base64 encoded certificate, add header/footer and load it with X509.Read function to inspect.  
See also [GetFieldsAsJSON](https://www.monkeybreadsoftware.com/DynaPDF-Manual/GetFieldEx.shtml) function in DynaPDF manual.

### Examples

Query JSON:

 Set Variable \[ $JSON ; Value: MBS ( "DynaPDF.GetFieldsAsJSON"; PDF ) \]  
Query document information:

 Set Variable \[ $pdf ; Value: MBS ("[DynaPDF.New](DynaPDFNew.md)") \]   
\# Load PDF from container   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $pdf ; PDF JSON::PDF ) \]   
\# import a page   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $pdf ; 1) \]   
\#   
\# query all fields:   
Set Variable \[ $JSON ; Value: MBS ("DynaPDF.GetFieldsAsJSON"; $pdf ) \]   
If \[ MBS ("IsError") = 0 \]   
 Set Variable \[ $JSON ; Value: MBS ("[JSON.Colorize](JSONColorize.md)"; $JSON ) \]   
End If  
\#   
\# store in field   
Set Field \[ PDF JSON::JSON ; $JSON \]   
\# Release memory   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.Release](DynaPDFRelease.md)"; $pdf ) \]  
### See also

- [DynaPDF.GetField](DynaPDFGetField.md)
- [DynaPDF.GetFieldAsJSON](DynaPDFGetFieldAsJSON.md)
- [DynaPDF.GetFontAsJSON](DynaPDFGetFontAsJSON.md)
- [DynaPDF.GetFontsAsJSON](DynaPDFGetFontsAsJSON.md)
- [DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Release](DynaPDFRelease.md)
- [IsError](IsError.md)
- [JSON.Colorize](JSONColorize.md)
- [X509.Read](X509Read.md)

### Release notes

- **Version 11.5**
    - Added new fields FmtTextColor and FmtText for [DynaPDF.GetField](https://www.mbsplugins.eu/DynaPDFGetField.shtml) and [DynaPDF.GetFieldsAsJSON](https://www.mbsplugins.eu/DynaPDFGetFieldsAsJSON.shtml).
- **Version 11.2**
    - Fixed [DynaPDF.GetFieldsAsJSON](https://www.mbsplugins.eu/DynaPDFGetFieldsAsJSON.shtml) function to produce better JSON.
- **Version 11.0**
    - Fixed [DynaPDF.GetFieldAsJSON](https://www.mbsplugins.eu/DynaPDFGetFieldAsJSON.shtml) and [DynaPDF.GetFieldsAsJSON](https://www.mbsplugins.eu/DynaPDFGetFieldsAsJSON.shtml) to return ActionType with that key name instead of Action twice.
- **Version 10.5**
    - Added [DynaPDF.GetAnnotationsAsJSON](https://www.mbsplugins.eu/DynaPDFGetAnnotationsAsJSON.shtml), [DynaPDF.GetBookmarksAsJSON](https://www.mbsplugins.eu/DynaPDFGetBookmarksAsJSON.shtml), [DynaPDF.GetColorSpacesAsJSON](https://www.mbsplugins.eu/DynaPDFGetColorSpacesAsJSON.shtml), [DynaPDF.GetDocInfoAsJSON](https://www.mbsplugins.eu/DynaPDFGetDocInfoAsJSON.shtml), [DynaPDF.GetEmbeddedFilesAsJSON](https://www.mbsplugins.eu/DynaPDFGetEmbeddedFilesAsJSON.shtml), [DynaPDF.GetFieldsAsJSON](https://www.mbsplugins.eu/DynaPDFGetFieldsAsJSON.shtml), [DynaPDF.GetFontsAsJSON](https://www.mbsplugins.eu/DynaPDFGetFontsAsJSON.shtml), [DynaPDF.GetImportDocInfoAsJSON](https://www.mbsplugins.eu/DynaPDFGetImportDocInfoAsJSON.shtml) and [DynaPDF.SysFontInfoAsJSON](https://www.mbsplugins.eu/DynaPDFSysFontInfoAsJSON.shtml) functions.

### Example Databases

- [DynaPDF/PDF JSON](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20JSON.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 11.5pr3](https://www.mbsplugins.de/archive/2021-10-25/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.2pr1](https://www.mbsplugins.de/archive/2021-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.0pr6](https://www.mbsplugins.de/archive/2021-01-09/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 10.5](https://www.mbsplugins.de/archive/2020-11-23/New_in_MBS_FileMaker_Plugin_10/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.5pr1](https://www.mbsplugins.de/archive/2020-10-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Embrace JSON](https://www.mbsplugins.de/archive/2020-09-29/Embrace_JSON/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 6/2020, Seite 26](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)

This function checks for a license.

Created 16th September 2020 , last changed 3th December 2024

  
[DynaPDF.GetFieldType](DynaPDFGetFieldType.md) - [DynaPDF.GetFontAsJSON](DynaPDFGetFontAsJSON.md)

[HTML Version](DynaPDFGetFieldsAsJSON.shtml)