form sap i reference
TRANSCRIPT
-
8/11/2019 Form Sap i Reference
1/156
ADOBE SYSTEMS INCORPORATED
Corporate Headquarters
345 Park Avenue
San Jose, CA 95110-2704
(408) 536-6000
http://partners.adobe.com
bbc
May 2003
Technical Note #5181
Version : Acrobat 6.0
Acrobat Forms APIReference
-
8/11/2019 Form Sap i Reference
2/156
-
8/11/2019 Form Sap i Reference
3/156
Acrobat Developer FAQ
PDF Creation APIs
and Specifications
Acrobat Interapplication
Communication (IAC)
Acrobat Core API Extended API for Plug-in
Acrobat Core
API Reference
Acrobat Distiller
Parameters
Acrobat Distiller
API Reference
pdfmark
Reference
Digital Signature API
Reference
Forms API Reference
Search API Reference
Weblink API Reference
Acrobat SDK Release Notes
Catalog API Reference
Acrobat SDK Samples Guide
Acrobat Core
API Overview
Acrobat Plug-in Tutorial
Acrobat IAC Overview
Acrobat IAC Reference
ADM Programmers
Guide and Reference
Getting Started Using the Acrobat Software Development Kit
Using the Save as
XML Plug-in
Spelling API Reference
Acrobat SDK Documentation Roadmap
AcroColor API Reference
Acrobat Development Overview
PDF Consultant
Accessibility Checker
PDF Reference
Manual
JavaScript
Acrobat JavaScript
ScriptingReference
Acrobat
JavaScript
Scripting Guide
Programming
Acrobat JavaScript
Using Visual Basic
Upgrading Plug-ins from Acrobat 5.0 to Acrobat 6.0
Reader EnablingPDF Specification
Getting Started
http://../Getting_Started/DeveloperFAQ.pdfhttp://../Core_API/CoreAPIReference.pdfhttp://../Core_API/CoreAPIReference.pdfhttp://../PDF_Creation_APIs/DistillerParameters.pdfhttp://../PDF_Creation_APIs/DistillerParameters.pdfhttp://../PDF_Creation_APIs/DistillerAPIReference.pdfhttp://../PDF_Creation_APIs/DistillerAPIReference.pdfhttp://../PDF_Creation_APIs/pdfmarkReference.pdfhttp://../PDF_Creation_APIs/pdfmarkReference.pdfhttp://../Extended_API_For_Plugins/DigitalSignatureAPIRef.pdfhttp://../Extended_API_For_Plugins/DigitalSignatureAPIRef.pdfhttp://../Extended_API_For_Plugins/FormsAPIReference.pdfhttp://../Extended_API_For_Plugins/SearchAPIReference.pdfhttp://../Extended_API_For_Plugins/WeblinkAPIReference.pdfhttp://../Getting_Started/ReleaseNotes.pdfhttp://../Extended_API_For_Plugins/CatalogAPIReference.pdfhttp://../Getting_Started/SamplesGuide.pdfhttp://../Core_API/CoreAPIOverview.pdfhttp://../Core_API/CoreAPIOverview.pdfhttp://../Getting_Started/PluginTutorial.pdfhttp://../InterApplication_Communication/IACOverview.pdfhttp://../InterApplication_Communication/IACReference.pdfhttp://../Extended_API_For_Plugins/ADMReferenceGuide.pdfhttp://../Extended_API_For_Plugins/ADMReferenceGuide.pdfhttp://../Getting_Started/GettingStarted.pdfhttp://../Extended_API_For_Plugins/SaveAsXML.pdfhttp://../Extended_API_For_Plugins/SaveAsXML.pdfhttp://../Extended_API_For_Plugins/SpellingAPIReference.pdfhttp://../Extended_API_For_Plugins/AcroColorAPIReference.pdfhttp://../Getting_Started/DevelopmentOverview.pdfhttp://../Extended_API_For_Plugins/PDFConsultant.pdfhttp://../Extended_API_For_Plugins/PDFConsultant.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../JavaScript/AcroJS.pdfhttp://../JavaScript/AcroJS.pdfhttp://../JavaScript/AcroJS.pdfhttp://../JavaScript/AcroJSGuide.pdfhttp://../JavaScript/AcroJSGuide.pdfhttp://../JavaScript/AcroJSGuide.pdfhttp://../JavaScript/VBJavaScript.pdfhttp://../JavaScript/VBJavaScript.pdfhttp://../JavaScript/VBJavaScript.pdfhttp://../Getting_Started/Upgrading.pdfhttp://../Getting_Started/ReaderEnabling.pdfhttp://../Getting_Started/ReaderEnabling.pdfhttp://../Getting_Started/Upgrading.pdfhttp://../JavaScript/VBJavaScript.pdfhttp://../JavaScript/AcroJSGuide.pdfhttp://../JavaScript/AcroJSGuide.pdfhttp://../JavaScript/AcroJS.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../Extended_API_For_Plugins/PDFConsultant.pdfhttp://../Getting_Started/DevelopmentOverview.pdfhttp://../Extended_API_For_Plugins/AcroColorAPIReference.pdfhttp://../Extended_API_For_Plugins/SpellingAPIReference.pdfhttp://../Extended_API_For_Plugins/SaveAsXML.pdfhttp://../Getting_Started/GettingStarted.pdfhttp://../Getting_Started/GettingStarted.pdfhttp://../Extended_API_For_Plugins/ADMReferenceGuide.pdfhttp://../InterApplication_Communication/IACReference.pdfhttp://../InterApplication_Communication/IACOverview.pdfhttp://../Getting_Started/PluginTutorial.pdfhttp://../Core_API/CoreAPIOverview.pdfhttp://../Getting_Started/SamplesGuide.pdfhttp://../Extended_API_For_Plugins/CatalogAPIReference.pdfhttp://../Getting_Started/ReleaseNotes.pdfhttp://../Extended_API_For_Plugins/WeblinkAPIReference.pdfhttp://../Extended_API_For_Plugins/SearchAPIReference.pdfhttp://../Extended_API_For_Plugins/FormsAPIReference.pdfhttp://../Extended_API_For_Plugins/DigitalSignatureAPIRef.pdfhttp://../PDF_Creation_APIs/pdfmarkReference.pdfhttp://../PDF_Creation_APIs/DistillerAPIReference.pdfhttp://../PDF_Creation_APIs/DistillerParameters.pdfhttp://../Core_API/CoreAPIReference.pdfhttp://../Getting_Started/DeveloperFAQ.pdf -
8/11/2019 Form Sap i Reference
4/156
-
8/11/2019 Form Sap i Reference
5/156
Acrobat Forms API Reference
5
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What Is In This Document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Other Useful Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Conventions Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
AcroForm API Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
AcroForm Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
AcroForm Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
PDField . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Core Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
ASAtom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
ASBool. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
ASFile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18ASPathName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
AVDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
CosDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
CosObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
PDAnnot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
PDDoc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
PDPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
AcroForm Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
AFExecuteThisScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21AFImportAppearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
AFLayoutBorder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
AFLayoutCreateStream . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
AFLayoutDelete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AFLayoutNew . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
AFLayoutText . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
AFPDDocEnumPDFields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
AFPDDocGetPDFieldFromName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
-
8/11/2019 Form Sap i Reference
6/156
Contents
6
Acrobat Forms API Reference
AFPDDocLoadPDFields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
AFPDFieldFromCosObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
AFPDFieldGetCosObj . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AFPDFieldGetDefaultTextAppearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
AFPDFieldGetFlags. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35AFPDFieldGetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
AFPDFieldGetValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
AFPDFieldIsAnnot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
AFPDFieldIsTerminal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
AFPDFieldIsValid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
AFPDFieldReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
AFPDFieldSetDefaultTextAppearance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
AFPDFieldSetFlags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
AFPDFieldSetOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
AFPDFieldSetValue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
AFPDFormFromPage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
AFPDWidgetGetAreaColors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
AFPDWidgetGetBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
AFPDWidgetGetRotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
AFPDWidgetSetAreaColors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
AFPDWidgetSetBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
AssembleFormAndImportFDF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
ExportAsFDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
ExportAsFDFEx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
ExportAsFDFWithParams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
ExportAsHtml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
ExportAsHtmlEx. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
ImportAnFDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61IsPDDocAcroForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
ResetForm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
AcroForm Callbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
AFPDFieldEnumProc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
AcroForm Declarations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
AcroForm Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
AF_Flags_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
AFPDFieldBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
AFPDFieldFlags_t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
AFPDWidgetBorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
AFPDWidgetBorderRec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
AFPDWidgetBorderStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
ExportAsFDFParams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
ExportAsFDFParamsRec. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
-
8/11/2019 Form Sap i Reference
7/156
Acrobat Forms API Reference
7
Contents
RetCode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
TextAppearance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
TextAppearanceP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Core Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PDColorSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
PDColorValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
PDColorValueRec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
PDRotate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
AcroForm Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
Init_TextAppearanceP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
SetDefaultTextAppearanceP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
TextApperanceIsValid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Text-to-Speech API (Windows only) . . . . . . . . . . . . . . . . . . . . . . . . . 87
AFTTSGetNumberOfVoices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
AFTTSGetPitch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
AFTTSGetSpeaker. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
AFTTSGetSpeechRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
AFTTSGetVoiceName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
AFTTSGetVolume. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
AFTTSIsAvailable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
AFTTSPause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
AFTTSQSilence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
AFTTSQSound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97AFTTSQueueTextData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
AFTTSReset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
AFTTSResume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .100
AFTTSSetPitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101
AFTTSSetSpeaker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .102
AFTTSSetSpeechRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103
AFTTSSetVolume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
AFTTSStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .105
AFTTSTalk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .106
AcroForm OLE Automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108
Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
-
8/11/2019 Form Sap i Reference
8/156
Contents
8
Acrobat Forms API Reference
OLE Automation Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
AFormApp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
OLE Automation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111
PopulateListOrComboBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
SetBackgroundColor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
SetBorderColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
SetButtonCaption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .114
SetButtonIcon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115
SetExportValues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
SetForegroundColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117SetJavaScriptAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
SetResetFormAction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121
SetSubmitFormAction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
Add. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
AddDocJavascript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
ExecuteThisJavascript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126
ExportAsFDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
ExportAsHtml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
ImportAnFDF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129
Remove . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
OLE Automation Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .131
Alignment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .131
BorderStyle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .132
BorderWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133
ButtonLayout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .134
CalcOrderIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
CharLimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136
DefaultValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137Editable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Highlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
IsHidden . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
IsMultiline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .141
IsPassword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .142
IsReadOnly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .143
IsRequired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
IsTerminal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .145
-
8/11/2019 Form Sap i Reference
9/156
Acrobat Forms API Reference
9
Contents
Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .146
NoViewFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147
PrintFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .148
Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .149
TextFont . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150TextSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151
Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152
Value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .153
Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .155
_NewEnum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .156
-
8/11/2019 Form Sap i Reference
10/156
Contents
10
Acrobat Forms API Reference
-
8/11/2019 Form Sap i Reference
11/156
Acrobat Forms API Reference
11
Preface
The Adobe
Acrobat
Forms plug-in allows a Portable Document Format (PDF) document to
act as a form; that is, the Acrobat equivalent of a paper form with fields. It is now faster andeasier to exchange information either in familiar paper or electronic forms converted to
PDF files with Acrobat, or as dynamic interactive database templates.
N
O T E
:
Forms as used here do not refer to XObject
forms as defined in the PDF Reference.
The Forms plug-in for Acrobat (versions 4.0 and above) allows users to author form fields.
For Acrobat Reader, the Forms plug-in does not allow form authoring, but allows users to fill
in data and print Acrobat forms. The Reader Forms plug-in also does not allow users to savedata to the local hard disk. Both Acrobat and Reader allow Web designers to send data from
the form back to a Web server.
What Is In This Document
This document is a reference for developers who want to take advantage of the Forms API.
It is divided into two sections:
AcroForm API Reference
describes the Forms API and explains how to use it. It
includes the new Text-to-Speech APIs for Windows.
AcroForm OLE Automation
describes the OLE Automation methods exported by the
Adobe Acrobat AcroForm plug-in.
If you received this technical note without obtaining the entire Acrobat SoftwareDevelopment Kit (SDK), you can get the complete SDK by visiting:
http://partners.adobe.com/asn/developer/acrosdk/main.html.Other Useful
Documentation
Other Useful Documentation
You should be familiar with the Acrobat core API. The following technical notes provide this
information.
Acrobat Core API Overview,
technical note 5190,gives an overview of the objects and
methods provided by the Acrobat core API.
Acrobat Core API Reference,
technical note 5191,describes in detail the objects and methods
provided by the Acrobat core API.
Acrobat Development Overview
,technical note 5167, describes how to develop Acrobat
plug-ins on the various platforms available.
http://../PDF_Reference/PDFReference.pdfhttp://partners.adobe.com/asn/developer/acrosdk/main.htmlhttp://partners.adobe.com/asn/developer/acrosdk/main.htmlhttp://../Core_API/CoreAPIOverview.pdfhttp://../Core_API/CoreAPIReference.pdfhttp://../Getting_Started/DevelopmentOverview.pdfhttp://../Getting_Started/DevelopmentOverview.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../Getting_Started/DevelopmentOverview.pdfhttp://../Core_API/CoreAPIReference.pdfhttp://../Core_API/CoreAPIOverview.pdfhttp://partners.adobe.com/asn/developer/acrosdk/main.html -
8/11/2019 Form Sap i Reference
12/156
Preface
Conventions Used in This Book
12
Acrobat Forms API Reference
PDF Reference,
Fourth Edition, version 1.5. Provides a description of the PDF file format, as
well as suggestions for producing efficient PDF files.
Conventions Used in This Book
The Acrobat documentation uses text styles according to the following conventions.
Font Used for Examples
monospaced Paths and filenames
C:\templates\mytmpl.fm
Code examples set offfrom plain text
These are variable declarations:
AVMenu commandMenu,helpMenu;
monospaced bold Code items within plain
text
TheGetExtensionID
method ...
Parameter names and
literal values inreference documents
The enumeration terminates if proc
returns false
.
monospaced italic Pseudocode
ACCB1 void ACCB2 ExeProc(void){ do something
}
Placeholders in code
examples
AFSimple_Calculate(
cFunction
,cFields
)
blue Live links to Web pages The Acrobat Solutions Network URL is:
http://partners/adobe.com/asn/
Live links to sectionswithin this document
See Using the SDK.
Live links to other
Acrobat SDK documents
See theAcrobat Core API Overview
.
Live links to code items
within this document
Test whether anASAtom
exists.
bold PostScript language and
PDF operators,
keywords, dictionarykey names
The setpagedevice
operator
User interface names The File
menu
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
13/156
Acrobat Forms API Reference
13
Preface
Conventions Used in This Book
italic Document titles that are
not live links
Acrobat Core API Overview
New terms
User space
specifies coordinates for...
PostScript variables
filename
deletefile
Font Used for Examples
-
8/11/2019 Form Sap i Reference
14/156
Preface
Conventions Used in This Book
14
Acrobat Forms API Reference
-
8/11/2019 Form Sap i Reference
15/156
Acrobat Forms API Reference
15
AcroForm API Reference
Introduction
The Acrobat Forms plug-in exports its own Host Function Table (HFT), whose methods can
be used by other plug-ins. To use the Acrobat Forms plug-ins HFT, a plug-in must:
include the header file FormsHFT.h (which includes AF_ExpT.h and
AF_Sel.h)
.
import the HFT using ASExtensionMgrGetHFT
. A convenient way to do this is to use
the Init_AcroFormHFT
macro defined in FORMSHFT.H
.#define Init_AcroFormHFTASExtensionMgrGetHFT(ASAtomFromString(AcroFormHFT_NAME),AcroFormHFT_LATEST_VERSION)
assign the HFT returned by this call to a plug-in-defined global variable named
gAcroFormHFT.
Data may be imported and exported into Acrobat Forms in Forms Data Format (FDF). FDF is
used to submit form data to a server, as well as to receive the response and incorporate it
into a form. FDF is based on PDF and uses the same syntax and set of basic object types as
PDF. It also has the same file structure, except that the cross-reference table is optional. Seethe PDF Reference (Version 1.5, Fourth Edition),Section 8.6.6, for more information.
Contents
This reference contains the following:
AcroForm Objectsintroduces AcroForm-specific API objects and briefly describes Core
objects that are extensively used in the AcroForm API.
AcroForm Methodsdescribes in detail all AcroForm methods, including theirparameters, return value, and related methods.
AcroForm Callbacksdescribes in detail the callback functions.
AcroForm Declarationsdescribes in detail the data structures used by the AcrobatForms plug-in.
AcroForm Macrosdescribes in detail the macros available for use by developers.
Text-to-Speech API (Windows only)describes in detail all methods in the Text-to-SpeechAPI.
-
8/11/2019 Form Sap i Reference
16/156
AcroForm API Reference
Exceptions
16 Acrobat Forms API Reference
Exceptions
All AcroForm methods may return an exception. Possible exceptions are:
Exception Name Description
gAFpdErrExportFdf Error during export of FDF document.
gAFpdErrBadFdf Invalid FDF document.
gAFfileErrSubmitFdf Error opening URL to submit this form.
gAFpdErrReqdFld Required field found empty during export of FDFdocument.
-
8/11/2019 Form Sap i Reference
17/156
Acrobat Forms API Reference 17
AcroForm Objects
AcroForm Objects
ThePDFieldobject is introduced in the Forms API.
PDField
A PDFieldis an opaque object representing a field in an Acrobat form.
A PDF document that contains forms has an AcroFormentry in the document catalog
dictionary, which contains an array of references to each of the root fields in the document.
The three most important properties of a field are its type, name, and value. Other
properties specify the appearance of a field. Fields can be organized into a hierarchy, andother field properties associate it with its parent and children.
There is a field dictionary for every PDField. Acrobat uses annotations to represent afields appearance and to manage user interactions. A PDFielddictionary may also be anannotation, in which case its subtype isWidget. There is no ambiguity, because the keysof annotations and PDFields do not overlap.
PDFields are not created until needed. This saves memory and enhances performance.Suppose, for example, a PDF file represents a 100-page catalog, where a purchase order is
on the last page. PDFields are not created for all the elements in the purchase orderwhen the document is opened. When the user displays the purchase order, the annotationhandler draws the field announcements and creates the PDFields for form fields.
When the annotation handler creates a PDField, it typically displays a page that containsthe field.
-
8/11/2019 Form Sap i Reference
18/156
AcroForm Objects
Core Objects
18 Acrobat Forms API Reference
Core Objects
These objects are defined in the Acrobat Core API and used by the Forms API. For further
information about these objects, see theAcrobat Core API Reference.
ASAtom
A hashed token used in place of strings to optimize performance (it is much faster to
compareASAtomsthan strings).
ASBool
A boolean value.
ASFile
An opaque representation of an open file.
ASPathName
A file system-specific named location for a particular type of device. Uses the ASFileSysstructure pointers for callback. An ASPathNameis specific to a givenASFileSys.
AVDoc
A view of a PDF document in a window. There is one AVDocper displayed document.Unlike a PDDoc, an AVDochas a window associated with it.
CosDoc
A Cos-level representation of an entire PDF file.
CosObj
A general object in a PDF file, which may be of any Cos object type.
http://../Core_API/CoreAPIReference.pdfhttp://../Core_API/CoreAPIReference.pdf -
8/11/2019 Form Sap i Reference
19/156
Acrobat Forms API Reference 19
AcroForm Objects
Core Objects
PDAnnot
A structure that defines objects and methods used to manipulate annotations, as per the
logical model defined in the PDF specification.
PDDoc
The underlying PDF representation of a document. There is a correspondence between a
PDDocand an ASFile; the PDDocobject is the hidden object behind every AVDoc. AnASFilemay have zero or more underlying files, so a PDF file does not always correspondto a single disk file. For example, an ASFilemay provide access to PDF data in a database.
ThroughPDDocs, your application can perform most of the Edit -> Pagesmenu items fromAcrobat (delete, replace, and so on). You can create and delete thumbnails through thisobject. You can also set and retrieve document information fields through this object as
well. The first page in a PDDocis page 0.
PDPage
A single page in the PDF representation of a document. Just as PDF files are partiallycomposed of their pages, PDDocsare composed of PDPages. A page contains a series ofobjects representing the objects drawn on the page (PDGraphic), a list of resources usedin drawing the page, annotations (PDAnnot), an optional thumbnail image of the page,and the beads used in any articles that occur on the page. The first page in a PDDocis page0.
-
8/11/2019 Form Sap i Reference
20/156
AcroForm Objects
Core Objects
20 Acrobat Forms API Reference
-
8/11/2019 Form Sap i Reference
21/156
Acrobat Forms API Reference 21
AcroForm Methods
AFExecuteThisScript
ASBoolAFExecuteThisScript (PDDocpdd, const char* cScript,char** pRetValue);
Description
Executes a JavaScript script.
Parameters
Return Value
The JavaScript value ofevent.rc. This function pre-initializes it to true; a script may setit to falseif desired.
Header File
AF_Sel.h
Example
AVDoc avDoc = AVAppGetActiveDoc();PDDoc pdDoc = AVDocGetPDDoc (avDoc);char * buf = "console.println(\"myName\");";AFExecuteThisScript(pdDoc, buf, NULL);
pdd ThePDDocin which the script is to be executed.
cScript A string containing the text of the script to be executed. If Unicode, thestring must begin with 0xFEFF and end with 2 null bytes. If this is not the
case, it is assumed to be in the application's language encoding, asreturned by AVAppGetLanguageEncoding.
pRetValue To get a return value from the execution of the script, pass a non-NULLvalue for this parameter. If on return *pRetValis non-NULL, the callershould dispose of the string by calling ASFree. If present, the value willbe in host encoding.
N O T E : The script sets this value by assigning it to event.value. SeetheAcrobat JavaScript Object Specificationfor more information.
-
8/11/2019 Form Sap i Reference
22/156
AcroForm Methods
22 Acrobat Forms API Reference
AFImportAppearance
ASBoolAFImportAppearance(CosDoccd, CosObj*coIcon,
AVDocavd, char *cTitle);Description
Opens the dialog box that allows the user to select a PDF to use as the icon for a button.
Parameters
Return Value
trueif appearance was imported properly, falseotherwise.
Header File
AF_Sel.h
Related Methods
None
Example
AVDoc avDoc = AVAppGetActiveDoc();PDDoc pdDoc = AVDocGetPDDoc (avDoc);char ReturnValue[128] = "";char* pReturnValue = ReturnValue;char* buf = "var rc = app.response({cQuestion: 'What is the company ?',
cDefault: 'Adobe'} ); if(rc!=null) event.value=rc;";ASBool bRc = AFExecuteThisScript (pdDoc, buf, &pReturnValue);
if(pReturnValue) {AVAlertNote(pReturnValue)ASfree(pReturnValue);}
cd TheCosDocthat contains the appearance you are trying to import.
coIcon If AFImportAppearanceis successful,coIconis a pointer to a CosObjthat will contain the Cos representation of the appearance.
avd TheAVDocthat you want the window to be the child of. You can pass NULLif you do not have an AVDoc.
cTitle The window title of the dialog box when it appears. You can pass NULLifyou want the title of the dialog to be the same as it is when brought upthrough the field properties dialog.
-
8/11/2019 Form Sap i Reference
23/156
-
8/11/2019 Form Sap i Reference
24/156
AcroForm Methods
24 Acrobat Forms API Reference
AFLayoutCreateStream
CosObjAFLayoutCreateStream (void* vlayout);
Description
Creates a layout stream that can be used as an annotation appearance.
Parameters
Return Value
A stream CosObj.
Header File
AF_Sel.h
Related Methods
AFLayoutNew
AFLayoutDelete
Example
// Write the whole thing to a CosStream.CosObj coStream = AFLayoutCreateStream(layout);AFLayoutDelete(layout);
vlayout The layout of the annotation. UseAFLayoutNewto create a new layoutbefore calling this method.
-
8/11/2019 Form Sap i Reference
25/156
Acrobat Forms API Reference 25
AcroForm Methods
AFLayoutDelete
void AFLayoutDelete (void* vlayout);
Description
Frees the layout context.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFLayoutNewAFLayoutCreateStream
Example
CosObj coStream = AFLayoutCreateStream(layout);AFLayoutDelete(layout);
vlayout The layout of the annotation to remove.
-
8/11/2019 Form Sap i Reference
26/156
AcroForm Methods
26 Acrobat Forms API Reference
AFLayoutNew
void* AFLayoutNew (ASFixedRectP frBbox,
PDRotateannotRotation, CosDoc cd);Description
Create a new layout context for annotations. Use PDAnnotGetRectto get theannotations bounding box, then use this method to define new layout context.
Parameters
Return Value
A new layout.
Header File
AF_Sel.h
Related Methods
AFLayoutBorder
AFLayoutTextAFLayoutCreateStream
Example
PDAnnotGetRect (theAnnot, &frBBox);void *layout = AFLayoutNew (&frBBox, PDPageGetRotate (pdPage),theCosDoc);
frBbox The bounding box of the area for text and border data to flowinto.
annotRotation The rotation of the annotation.
cd TheCosDoc.
-
8/11/2019 Form Sap i Reference
27/156
Acrobat Forms API Reference 27
AcroForm Methods
AFLayoutText
void AFLayoutText (void* vlayout, ASBoolbMultline,
ASBoolbWrap, AFPDWidgetBorderRecborder, TextAppearancePta,char* cBytes);
Description
Sets the text layout for the annotation.
N O T E : Before calling this method, you should call AFLayoutNewto create a new layout,as well as AFLayoutBorder.
Parameters
Return Value
None
Exceptions
Raises an exception if the field is a radio box or button.
Header FileAF_Sel.h
Related Methods
AFLayoutNewAFLayoutBorder
vlayout The layout of the annotation.
bMultline If true, the text can use multiple lines in a text field. Otherwise, textis single line.
bWrap If true, the text will wrap.
border The border appearance that defines the width and line style of aborder.
The border of the annotation should be the same as in your call to
AFLayoutBorder.
ta A pointer to structure containing font, point size, and colorinformation. You should initialize the structure with the
SetDefaultTextAppearancePmacro which defaults toHelvetica.
cBytes The text string for the layout.
-
8/11/2019 Form Sap i Reference
28/156
AcroForm Methods
28 Acrobat Forms API Reference
Example
PDAnnotGetBBox(theAnnot, &frBBox);void *layout = AFLayoutNew(&frBBox, PDPageGetRotate(pdPage), theCosDoc);AFLayoutBorder(layout, &border, &pdcvBorder, &pdcvBackground, false);
AFLayoutText(layout, true, true, &border, &textAppearance, "Welcome toAcroForm");
-
8/11/2019 Form Sap i Reference
29/156
Acrobat Forms API Reference 29
AcroForm Methods
AFPDDocEnumPDFields
void AFPDDocEnumPDFields (PDDocdoc, ASBoolterminals,
ASBoolno_repeat, AFPDFieldEnumProcproc, void *clientData);Description
Enumerates all PDFields that exist in a PDDoc.
Parameters
Return Value
None
Header File
AF_Sel.h
Example
AVDoc currentAVDoc;PDDoc currentPDDoc;AFPDFieldEnumProc enumProc;
currentAVDoc = AVAppGetActiveDoc ();currentPDDoc = AVDocGetPDDoc (currentAVDoc);
/* Set up enumeration */enumProc = ASCallbackCreateProto (AFPDFieldEnumProc, &FieldEnumProc);
AFPDDocEnumPDFields (currentPDDoc, false, false, enumProc, NULL);
doc ThePDDocwhose PDFields are enumerated.
terminals If true, only PDFields without children are enumerated.
no_repeat If true, then only one instance of a PDFieldfor each name isenumerated.
proc A user-supplied callback that is called for each PDField. Theenumeration terminates if procreturns false.
clientData Pointer to user-specified data that is passed to proceach time it iscalled.
-
8/11/2019 Form Sap i Reference
30/156
AcroForm Methods
30 Acrobat Forms API Reference
AFPDDocGetPDFieldFromName
PDFieldAFPDDocGetPDFieldFromName (PDDocdoc, char* name);
Description
Retrieves a PDFieldwith a given name from a PDDoc. (If multiple fields have the samename, a change to any of them affects all of them.)
Parameters
Return Value
ThePDFieldspecified by name. Returns NULLif there is no PDFieldwith the givenname in the PDDoc.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetName
doc ThePDDoccontaining the field.
name Name of the field to retrieve.
-
8/11/2019 Form Sap i Reference
31/156
Acrobat Forms API Reference 31
AcroForm Methods
AFPDDocLoadPDFields
void AFPDDocLoadPDFields (PDDocdoc);
Description
Makes sure every PDFieldin the given PDDoc exists.
N O T E : It is no longer necessary to call this method. It still exists for backwards
compatibility, but its purpose is now automatically taken care of internally.
Parameters
Return Value
None
Header File
AF_Sel.h
doc ThePDDocfor the form whose PDFields are loaded.
-
8/11/2019 Form Sap i Reference
32/156
AcroForm Methods
32 Acrobat Forms API Reference
AFPDFieldFromCosObj
PDFieldAFPDFieldFromCosObj (CosObjdict);
Description
Retrieves the PDFieldobject for which a Cos object is the dictionary.
Parameters
Return Value
ThePDFieldcorresponding to dict. Returns NULLif the Cos object is not a PDField.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetCosObj
Example
PDAnnot anAnnotation;CosObj annotCosObj;PDField annotField;
/* Get PDField for Cos object */
annotCosObj = PDAnnotGetCosObj (anAnnotation);annotField = AFPDFieldFromCosObj (annotCosObj);
dict The Cos object for which to retrieve the correspondingPDFieldobject.
-
8/11/2019 Form Sap i Reference
33/156
Acrobat Forms API Reference 33
AcroForm Methods
AFPDFieldGetCosObj
CosObjAFPDFieldGetCosObj (PDFieldfldP);
Description
Retrieves the Cos object which is the field object of a PDFieldobject.
Parameters
Return Value
Cos object corresponding to the PDFieldobject fldP.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetCosObjAFPDFieldGetDefaultTextAppearanceAFPDFieldGetNameAFPDFieldGetValue
Example
PDField fldP;CosObj fieldCosObject;
if (AFPDFieldIsValid (fldP)) {/* Get Cos Object for field */fieldCosObject = AFPDFieldGetCosObj (fldP);
fldP ThePDFieldobject for which to retrieve the corresponding Cos object.
-
8/11/2019 Form Sap i Reference
34/156
-
8/11/2019 Form Sap i Reference
35/156
Acrobat Forms API Reference 35
AcroForm Methods
AFPDFieldGetFlags
ASUns32 AFPDFieldGetFlags (PDFieldfldP, AF_Flags_tflagType);
Description
Retrieves the flags of a PDFieldfor a given flag type.
Parameters
Return Value
The value of flags offlagType.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetName
AFPDFieldGetValue
AFPDFieldSetFlags
fldP ThePDFieldwhose flags are obtained.
flagType Type of flags to obtain.
-
8/11/2019 Form Sap i Reference
36/156
AcroForm Methods
36 Acrobat Forms API Reference
AFPDFieldGetName
char* AFPDFieldGetName (PDFieldfldP);
Description
Gets the name of a PDFieldobject.
Parameters
Return Value
A C program NULL-terminated string.
N O T E : Do not modify or free this string. To use this string indefinitely, copy it to a private
buffer.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetDefaultTextAppearanceAFPDFieldGetValue
Example
PDField fldP;
char *fieldName;
fieldName = AFPDFieldGetName (fldP);
fldP ThePDFieldwhose name is retrieved.
-
8/11/2019 Form Sap i Reference
37/156
Acrobat Forms API Reference 37
AcroForm Methods
AFPDFieldGetValue
CosObjAFPDFieldGetValue (PDFieldfldP);
Description
Retrieves the value from a PDField. The value is stored in the field entry with the Vkey.
Values can be inherited. If a PDFieldCos object does not have a Vkey, its value isinherited from a parents Vkey (the parent must have the same name as the PDField). Forexample, radio buttons inherit values this way.
N O T E : Retrieving the value of a radio button or combo box requires Cos-level
programming. See the PDF Referencefor details.
Parameters
Return Value
The value of the field as aCosObj. If the field has no value, a NULL CosObjis returned.
Header File
AF_Sel.h
Related Methods
AFPDFieldGetCosObjAFPDFieldGetDefaultTextAppearanceAFPDFieldGetNameAFPDFieldSetValue
Example
This example shows how to obtain the string value of an encoded string from the CosObj.
PDField fldP;CosObj fieldCosValue = AFPDFieldGetValue(fldP);char *fieldValue = CosCopyStringValue(fieldCosValue, NULL);ASText asText = ASTextFromPDText(fieldValue);char *realField = ASTextGetEncodedCopy(asText,
(ASHostEncoding)PDGetHostEncoding());
fldP ThePDFieldwhose value is retrieved.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
38/156
AcroForm Methods
38 Acrobat Forms API Reference
AFPDFieldIsAnnot
ASBoolAFPDFieldIsAnnot (PDFieldfldP);
Description
Determines whether or not a PDFieldis an annotation (PDAnnot), that is, whether thefield dictionary is also an annotation. If this is the case, the value of Subtypeis Widget.
Parameters
Return Value
trueif the PDFieldis an Acrobat annotation, falseotherwise.
Header File
CosField.h
Related Methods
AFPDFieldIsTerminalAFPDFieldIsValid
Example
PDField fldP;
if (AFPDFieldIsAnnot (fldP)) {
/* Process annotation */
fldP The field in question.
-
8/11/2019 Form Sap i Reference
39/156
Acrobat Forms API Reference 39
AcroForm Methods
AFPDFieldIsTerminal
ASBoolAFPDFieldIsTerminal (PDFieldfldP);
Description
Determines whether a field is terminal: the field has no children or it has the same name asits children.
Parameters
Return Value
If true, fldPis valid and all its children (if any) have the same name as fldP. Otherwise
all have unique names.Header File
AF_Sel.h
Related Methods
AFPDFieldIsAnnot
AFPDFieldIsValid
Example
PDField fldP;
if (AFPDFieldIsTerminal (fldP)) {/* Process field */
fldP ThePDFieldto test.
-
8/11/2019 Form Sap i Reference
40/156
AcroForm Methods
40 Acrobat Forms API Reference
AFPDFieldIsValid
ASBoolAFPDFieldIsValid (PDFieldfldP);
Description
Determines whether a field is valid or not.
N O T E : This method is intended only to ensure that the field has not been deleted, not to
ensure that all necessary information is present and the field has valid values.
Parameters
Return Value
trueiffldPis a valid PDField; falseotherwise.
Header File
AF_Sel.h
Related Methods
AFPDFieldIsAnnot
AFPDFieldIsTerminal
Example
PDField fldP;
if (AFPDFieldIsValid (fldP)) {/* Process field */}
fldP The field to test.
-
8/11/2019 Form Sap i Reference
41/156
Acrobat Forms API Reference 41
AcroForm Methods
AFPDFieldReset
void AFPDFieldReset (PDFieldfldP);
Description
Sets a PDFields value to its default state. This is the value associated with the DVkey forthe field. If there is no DVkey for the field, set the fields value to the NULLCos object; or, ifthe field has options, the default DVis the first element of the Optarray.
ADVentrys value can be inherited from a parent ( just like V).
ThePDFields value is set only if it is terminal; see AFPDFieldIsTerminal.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
ResetForm
Example
AVDoc currentAVDoc;PDField annotField;
/* Remove current field selection, so selected field is operated on */currentAVDoc = AVAppGetActiveDoc ();AFPDFieldReset (annotField);
fldP ThePDFieldto reset.
-
8/11/2019 Form Sap i Reference
42/156
AcroForm Methods
42 Acrobat Forms API Reference
AFPDFieldSetDefaultTextAppearance
void AFPDFieldSetDefaultTextAppearance(PDFieldfldP,
TextAppearancePaP);Description
Sets the default text appearance of a field. Use this method to set the font, size, color, and
so forth.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDWidgetSetAreaColors
fldP ThePDFieldobject for which to set the text appearance.
aP A pointer to a structure describing the text appearance to set.
-
8/11/2019 Form Sap i Reference
43/156
Acrobat Forms API Reference 43
AcroForm Methods
AFPDFieldSetFlags
void AFPDFieldSetFlags (PDFieldfldP, AF_Flags_tflagType,
AFPDFieldFlags_tflags);Description
Sets the flags of type flagTypefor a PDField.
The flags of a fields children (if any) are also set.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDFieldGetDefaultTextAppearance
AFPDFieldSetOptionsAFPDFieldSetValue
fldP ThePDFieldfor which to set flags and childrens flags.
flagType The type of the flags to set. If flagTypeisFlags_Annotand thePDFieldis not an annotation, no flags are changed.
flags The value of the flags.
-
8/11/2019 Form Sap i Reference
44/156
AcroForm Methods
44 Acrobat Forms API Reference
AFPDFieldSetOptions
RetCodeAFPDFieldSetOptions (PDFieldfldP, CosObjarray);
Description
Sets the options entry for a field. The options entry has the key Optand represents a list ofoptions for a choice field.
If the field is not valid, remove the options entry.
Parameters
Return Value
Goodif the operation succeeded, Badotherwise.
Header File
AF_Sel.h
Related Methods
AFPDFieldSetFlagsAFPDFieldSetValue
Example
const char cOption1[] = "Blue";const char cOption2[] = "Red";CosObj coOpts = CosNewArray(cd, false, 2);CosObj coOpt = CosNewString(cd, false, cOption1, strlen(cOption1));CosArrayPut(coOpts, 0, coOpt);coOpt = CosNewString(cd, false, cOption2, strlen(cOption2));CosArrayPut(coOpts, 1, coOpt);AFPDFieldSetOptions(coOpts);
fldP ThePDFieldwhose options are set.
array The value to set in the options entry.
-
8/11/2019 Form Sap i Reference
45/156
Acrobat Forms API Reference 45
AcroForm Methods
AFPDFieldSetValue
void AFPDFieldSetValue (PDFieldfldP, CosObjval);
Description
Sets the value for a PDField. The value is stored in the field entry with the Vkey. Updatesthe display of the field and its namesakes; that is, fields with the same fully qualified names,
if any. Changing the field dictionarys value for the Ventry directly does not change the
appearance of the field, which is represented by the APkey.
N O T E : Setting the value of a radio button or combo box requires Cos-level programming.
See the PDF Referencefor details.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDFieldGetValueAFPDFieldSetFlagsAFPDFieldSetOptions
Example
PDField fldP;CosDoc currentCosDoc;CosObj cosObject, newString;char *fieldName;ASInt32 fieldNameLength;
cosObject = AFPDFieldGetCosObj (fldP);currentCosDoc = CosObjGetDoc (cosObject);fieldName = AFPDFieldGetName (fldP);fieldNameLength = strlen (fieldName);newString = CosNewString (currentCosDoc, false, fieldName,fieldNameLength);AFPDFieldSetValue (fldP, newString);
fldP The field whose value is set.val The fields new value. If it is different than the previous value, all previous
instances of value keys (V) in the fields dictionary and those of its namesakes
(fields with the same fully qualified name) are removed.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
46/156
AcroForm Methods
46 Acrobat Forms API Reference
AFPDFormFromPage
CosObjAFPDFormFromPage (CosDoccd, PDPagepdp);
Description
Creates anXObjectform from a PDF page. A form XObject is a content stream that can betreated as a single graphics object. Use this method for importing PDF graphics into
documents.
Parameters
Return Value
A Cos object pointing to the XObjecton the PDF page.
Header File
AF_Sel.h
Related Methods
None
cd TheCosDocthat the XObjectwill be created in.
pdp ThePDPagethat you want to create the XObject from.
-
8/11/2019 Form Sap i Reference
47/156
Acrobat Forms API Reference 47
AcroForm Methods
AFPDWidgetGetAreaColors
void AFPDWidgetGetAreaColors(PDAnnotpdan,
PDColorValueborderP, PDColorValuebkgndP);Description
Gets the border and background colors of an annotation.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDWidgetSetAreaColors
pdan The annotation.
borderP (Filled by the method) A pointer to a structure representing the border colorof the annotation.
bkgndP (Filled by the method) A pointer to a structure representing the backgroundcolor of the annotation.
-
8/11/2019 Form Sap i Reference
48/156
AcroForm Methods
48 Acrobat Forms API Reference
AFPDWidgetGetBorder
ASBoolAFPDWidgetGetBorder(PDAnnotpdan,
AFPDWidgetBorderRecpdwb);Description
Gets the border of an annotation.
Parameters
Return Value
trueif successful getting border,falseotherwise.
Header File
AF_Sel.h
Related Methods
AFPDWidgetSetAreaColors
pdan The annotation.
pdwb (Filled by the method)A pointer to a structure describing the form fieldappearance definitions for the outside border of an annotation.
-
8/11/2019 Form Sap i Reference
49/156
Acrobat Forms API Reference 49
AcroForm Methods
AFPDWidgetGetRotation
ASAtomAFPDWidgetGetRotation (PDAnnotpdan);
Description
Gets the rotation of the annotation.
Parameters
Return Value
Returns a ASAtomobject representing the annotations rotation with respect to the page.
Header File
AF_Sel.h
Related Methods
None
pdan The annotation widget.
-
8/11/2019 Form Sap i Reference
50/156
AcroForm Methods
50 Acrobat Forms API Reference
AFPDWidgetSetAreaColors
void AFPDWidgetSetAreaColors(PDAnnotpdan,
PDColorValueborderP, PDColorValuebkgndP);Description
Sets the border and background color of the annotation.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDWidgetGetAreaColors
pdan The annotation.
borderP A pointer to a structure representing the border color of the annotation.
bkgndP A pointer to a structure representing the background color of theannotation.
-
8/11/2019 Form Sap i Reference
51/156
Acrobat Forms API Reference 51
AcroForm Methods
AFPDWidgetSetBorder
void AFPDWidgetSetBorder(PDAnnotpdan,
AFPDWidgetBorderRecpdwb);Description
Sets the border of an annotation.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDWidgetSetAreaColors
pdan The annotation whose change border appearance will be set.
pdwb A pointer to a structure describing the form field appearancedefinitions for the outside border of an annotation. Possible border
types are solid, dashed, beveled, inset, underline.
-
8/11/2019 Form Sap i Reference
52/156
AcroForm Methods
52 Acrobat Forms API Reference
AssembleFormAndImportFDF
PDDocAssembleFormAndImportFDF (PDDocpdCurrForm,
CosDoccdFDF, ASBoolbAddToCurr);Description
Constructs an Acrobat form from templates and imports an FDF file.
Parameters
Return Value
ThePDDocfor the newly-created form (or pdCurrForm, if bAddToCurristrue).
Header File
AF_Sel.h
Related Methods
ExportAsFDFExportAsFDFExExportAsFDFWithParamsImportAnFDF
Example
CosObj dictFDF = CosDictGet(CosDocGetRoot(cdFDF), FDF_K);if (CosObjGetType(CosDictGet(dictFDF, Pages_K)) == CosArray)
AssembleFormAndImportFDF(0/*no current doc is open*/, cdFDF, false);
pdCurrform The current form being viewed, if any, at the time cdFDFis beingimported. This parameter can be NULL; if not NULL, then cdFDFcan refer to templates in the current form, by omitting the F key in
the TRefdictionary. Even if the Fkey is not NULL, it can be a relativepath (as opposed to an absolute path), as long as pdCurrFormis
not NULL.
cdFDF The FDF file being imported.
bAddToCurr If true(and pdCurrFormis not NULL), then instead of creating anew form, the templates spawn pages that are appended at the end
of pdCurrForm(and the function returns pdCurrForm).
-
8/11/2019 Form Sap i Reference
53/156
Acrobat Forms API Reference 53
AcroForm Methods
ExportAsFDF
CosDoc ExportAsFDF (PDDocpdForm, CosObjrgIncExcFlds,
ASBoolbIncl, ASBoolbEmpty, ASBoolbMenu, ASBoolbLoadFields,ASPathNamefdfPath);
Description
Exports form data to a CosDoc, which can be written to an FDF file. See the PDF Referencefor a description of this format.
To create an FDF file from this CosDoc, call the Core API method CosDocSaveToFile.
N O T E : ExportAsFDFWithParamsprovides the same functionality with additionaloptions.
Parameters
pdForm ThePDDocfor the form for which we want to export the data.
rgIncExcFlds If rgIncExcFldsisCosNewNull, then all fields are exported,and bInclis ignored. If rgIncExcFldsis a CosArray, then thearray elements may be:
a) names of fields (the names may be of non-terminal fields, which isa fast and easy way to cause all their children to be included in the
FDF file).
b) arrays, whose first element is a field name, and the rest of the
elements are field dictionary key names whose values should beexported in the FDF file.
For example: [ (My listbox) /AP /Opt ].
This variety ofrgIncExcFldsarray element can only be used ifbInclistrue(see below).c) If rgIncExcFldscontains a single element, which is itself anarray as described in b) above, and its first element, whichcorresponds to the field name, is NULL, then the FDF file will includethe requested field properties of all fields. For example:
[ null /F /Ff ].
bIncl If true, rgIncExcFldsis an array of the fields to export.Otherwise, rgIncExcFldsis an array of the fields to excludefromexporting.
bEmpty If true, all fields selected per the above criteria are exported. Iffalse, exclude fields that have no value.
bMenu If true, suppresses saving text fields that have the "password flagset, and does not force filling-in required fields when creating anFDF file.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
54/156
AcroForm Methods
54 Acrobat Forms API Reference
Return Value
The FDFCosDoccontaining the exported data.
Exceptions
Raises gAFpdErrExportFdfif it cannot export field data. The viewer may raise otherexceptions.
Header FileAF_Sel.h
Related Methods
ExportAsFDFExExportAsFDFWithParamsImportAnFDFAssembleFormAndImportFDF
Example
/* Export all fields to CosDoc */cosDoc = ExportAsFDF (currentPDDoc, rgFld, true, true, false, false,
NULL);
bLoadFields Not used.
fdfPath The path where the FDF file will be saved (by the client ofExportAsFDF) after it is produced. You need this in order to create
an FDF file with an Fkey that gives the relative path to the form,from the location where the FDF file will be saved. Pass NULLif anabsolute pathname is desired.
-
8/11/2019 Form Sap i Reference
55/156
Acrobat Forms API Reference 55
AcroForm Methods
ExportAsFDFEx
CosDoc ExportAsFDFEx (PDDocpdForm, CosObjrgIncExcFlds,
ASBoolbIncl, ASBoolbEmpty, ASBoolbMenu, ASBoolbLoadFields,ASPathNamefdfPath, const char* submitBtnName);
Description
Exports form data to a CosDoc, which can be written to an FDF file. See thePDF Referencefor a description of this format.
To create an FDF file from this CosDoc, call the Acrobat viewer plug-in API method
CosDocSaveToFile.
N O T E : This method is the same asExportAsFDF, with the exception of the additionalparameter submitBtnName. ExportAsFDFWithParamsprovides the samefunctionality with additional options.
Parameters
pdForm A PDDocfor the form whose data is exported.
rgIncExcFlds If rgIncExcFldsisCosNewNull, then all fields areexported, and bInclis ignored. If rgIncExcFldsis aCosArray, then the array elements may be:a) names of fields (the names may be of non-terminal fields,
which is a fast and easy way to cause all their children to be
included in the FDF file).
b) arrays, whose first element is a field name, and the rest of the
elements are field dictionary key names whose values should be
exported in the FDF file.
For example: [ (My listbox) /AP /Opt ].
This variety of rgIncExcFldsarray element can only be usedif bInclistrue(see below).c) If rgIncExcFldscontains a single element, which is itselfan array as described in b) above, and its first element, which
corresponds to the field name, isNULL, then the FDF file willinclude the requested field properties of all fields. For example:
[ null /F /Ff ].bIncl If true, rgIncExcFldsis an array of the fields to export.
Otherwise, rgIncExcFldsis an array of the fields to excludefrom exporting.
bEmpty If true, all fields selected per the above criteria are exported. Iffalse, exclude fields that have no value.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
56/156
AcroForm Methods
56 Acrobat Forms API Reference
Return Value
The FDFCosDoccontaining the exported data.
Exceptions
Raises gAFpdErrExportFdfif it cannot export field data. The viewer may raise otherexceptions.
Header FileAF_Sel.h
Related Methods
ExportAsFDFExportAsFDFWithParamsImportAnFDFAssembleFormAndImportFDF
Example
/* Export all fields to CosDoc */cosDoc = ExportAsFDFEx (currentPDDoc, rgFld, true, true, false, false,NULL, NULL);
bMenu If true, suppresses saving text fields that have the "passwordflag set, and doesnt force filling-in required fields when creatingan FDF file.
bLoadFields Not used.
fdfPath The path where the FDF file will be saved after it is produced.You need this in order to create an FDF file with an Fkey that
gives the relative path to the form, from the location where the
FDF file will be saved. Pass NULLif an absolute pathname isdesired.
submitBtnName A NULL-terminated string containing the name of the buttonused to submit. If the value passed is not NULL, then the FDFfile will include a field dictionary corresponding to the submit
button, which will only contain one key, namely T.
N O T E : This dictionary is no different than the one you get whenan AcroForm has an empty text field (that is, no value),
and parameter bEmptyis true.
-
8/11/2019 Form Sap i Reference
57/156
Acrobat Forms API Reference 57
AcroForm Methods
ExportAsFDFWithParams
CosDoc ExportAsFDFWithParams (ExportAsFDFParamsRecparams);
Description
Exports form data to a CosDoc, which can be written to an FDF file. See thePDF Referencefor a description of this format.
Parameters
Return Value
The FDFCosDoccontaining the exported data.
N O T E : Call CosDocSaveToFileto create an FDF file from this CosDoc.
Exceptions
Raises gAFpdErrExportFdfif cannot export field data. The viewer may raise otherexceptions.
Header File
AF_Sel.h
Related Methods
ExportAsFDF
ExportAsFDFExImportAnFDFAssembleFormAndImportFDF
params An ExportAsFDFParamsRecstructure.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
58/156
AcroForm Methods
58 Acrobat Forms API Reference
ExportAsHtml
void ExportAsHtml (PDDocformPD, CosObjrgIncExcFlds,
ASBoolbIncl, ASBoolbEmpty, ASFileHfile);Description
Exports data from a form to a file in HTML format.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
ExportAsHtmlEx
formPD ThePDDocfor the form whose data is exported.
rgIncExcFlds IfrgIncExcFldsisCosNewNull, then all fields are exported, andbInclis ignored. If it is a CosArray, then the array elements mustbe indirect references to field dictionaries.
bIncl If true, rgIncExcFldsis an array of the fields to export.Otherwise, rgIncExcFldsis an array of the fields to excludefromexporting.
bEmpty If true, all fields selected per the above criteria are exported. Iffalse, exclude fields that have no value.
Hfile File to which the HTML data is written.
-
8/11/2019 Form Sap i Reference
59/156
Acrobat Forms API Reference 59
AcroForm Methods
ExportAsHtmlEx
void ExportAsHtmlEx (PDDocpdForm, CosObjrgIncExcFlds,
ASBoolbIncl, ASBoolbEmpty, ASFileHfile,const char* submitBtnName);
Description
Exports data from a form to a file in HTML format.
N O T E : This method is the same asExportAsHtml,with the exception of the additionalparameter submitBtnName.
Parameters
Return ValueNone
Header File
AF_Sel.h
pdForm ThePDDocfor the form whose data is exported.
rgIncExcFlds If rgIncExcFldsisCosNewNull, then all fields areexported, and bInclis ignored. If it is a CosArray, then thearray elements must be names of fields. The names may be ofnon-terminal fields, which is a fast and easy way to cause all
their children to be exported.
bIncl If true, rgIncExcFldsis an array of the fields to export.Otherwise, rgIncExcFldsis an array of the fields to excludefrom exporting.
bEmpty If true, all fields selected per the above criteria are exported. Iffalse, exclude fields that have no value.
Hfile File to which the HTML data is written.
submitBtnName A NULL-terminated string containing the name of the buttonused to submit. If the value passed is not NULL, then include"...&submitBtnName=&..." as part of the generated x-
www-form-urlencodedoutput.
N O T E : This type of output is the same one you get when an
AcroForm has an empty text field (that is, no Value), and
parameter bEmptyis true.
-
8/11/2019 Form Sap i Reference
60/156
AcroForm Methods
60 Acrobat Forms API Reference
Related Methods
ExportAsHtmlImportAnFDF
-
8/11/2019 Form Sap i Reference
61/156
Acrobat Forms API Reference 61
AcroForm Methods
ImportAnFDF
ASBoolImportAnFDF (PDDocpdForm, CosDoccdFDF);
Description
Imports data from an FDF file into a PDDocs form. See the PDF Referencefor a descriptionof this format.
Parameters
Return Value
trueif the fields in the FDF file only contained values or flags (that is, V, F,Ff, ClrF, ClrFf,SetF, SetFf), falseif any field contained other attributes, such as appearances (that is,AP), actions (that is, A), and so forth.
Exceptions
Raises gAFpdErrBadFdfif the FDF file is invalid.
Raises an exception if memory cannot be allocated for FDF file data.
Header File
AF_Sel.h
Related Methods
AssembleFormAndImportFDFExportAsFDFExportAsFDFExExportAsFDFWithParams
pdForm ThePDDocfor the form into which we want to import the data.
cdFDF TheCosDocfor the FDF file containing the data.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
62/156
AcroForm Methods
62 Acrobat Forms API Reference
IsPDDocAcroForm
ASBoolIsPDDocAcroForm (PDDocdoc);
Description
Indicates whether a PDDoccontains an Acrobat form.
Parameters
Return Value
trueifdoccontains a form,falseotherwise.
Header File
AcroForm.h
Related Methods
AFPDFieldIsValid
Example
/* Return true if active doc has form */if ((avDoc = AVAppGetActiveDoc ()) != NULL)return IsPDDocAcroForm (AVDocGetPDDoc (avDoc));
doc ThePDDocto test.
-
8/11/2019 Form Sap i Reference
63/156
Acrobat Forms API Reference 63
AcroForm Methods
ResetForm
void ResetForm (PDDocformPD, CosObjrgIncExcFlds,
ASBoolbIncl);Description
Resets the indicated fields of a PDDocs form to their default values.
A PDFields value is reset only if it is terminal; see AFPDFieldIsTerminal.
Parameters
Return Value
None
Header File
AF_Sel.h
Related Methods
AFPDFieldSetDefaultTextAppearance
Example
AVDoc currentAVDoc;PDDoc currentPDDoc;CosObj rgFld = CosNewNull ();
ResetForm (currentPDDoc, rgFld, (ASBool)true);
formPD ThePDDocfor the form whose fields are reset.
rgIncExcFlds If rgIncExcFldsisCosNewNull, then all fields are reset, andbInclis ignored. If it is a CosArray, then the array elements mustbe names of fields. The names may be of non-terminal fields, whichis a fast and easy way to cause all their children to be reset.
bIncl If true,rgIncExcFldsis an array of the fields to reset. Otherwise,rgIncExcFldsis an array of the fields to excludefrom resetting.
-
8/11/2019 Form Sap i Reference
64/156
AcroForm Methods
64 Acrobat Forms API Reference
-
8/11/2019 Form Sap i Reference
65/156
Acrobat Forms API Reference 65
AcroForm Callbacks
AFPDFieldEnumProc
ACCB1 ASBoolACCB2 AFPDFieldEnumProc (PDFieldfldP,void *clientData);
Description
Callback used by AFPDDocEnumPDFields. It is called once for each PDFieldin a form.
Parameters
Return Value
trueto continue the enumeration, falseto halt enumeration.
Header File
AF_ExpT.h
Related Methods
AFPDDocEnumPDFields
fldP ThePDFieldcurrently being enumerated.
clientData User-supplied data passed in the call to AFPDDocEnumPDFields.
-
8/11/2019 Form Sap i Reference
66/156
AcroForm Callbacks
66 Acrobat Forms API Reference
-
8/11/2019 Form Sap i Reference
67/156
Acrobat Forms API Reference 67
AcroForm Declarations
This chapter describes the data types and declarations used in the AcroForms API.
AcroForm Data Types
Core Data Types
AcroForm Data Types
The following are data type and values defined in the AcroForms API.
AF_Flags_t
typedef enum {Flags_Annot,Flags_Field,SetFlagsAnnot,ClrFlagsAnnot,SetFlagsField,ClrFlagsField,
/* new in Acrobat 6.0 */FlagsIgnore} AF_Flags_t;
Description
The type of flag to be set inAFPDFieldSetFlags.
If Flags_Annot, SetFlagsAnnot, or ClrFlagsAnnotare specified and thePDFieldis not an annotation, no flags are changed. See the PDF Referencefor moreinformation on flags used for annotations.
Values
Flags_Annot Sets the flags defined in the Fkey of the annotation to thevalues specified in the flagsparameter ofAFPDFieldSetFlags.
Flags_Field Sets the flags defined in the Ffkey of the form field to thevalues specified in the flagsparameter ofAFPDFieldSetFlags.
http://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdfhttp://../PDF_Reference/PDFReference.pdf -
8/11/2019 Form Sap i Reference
68/156
AcroForm Declarations
AcroForm Data Types
68 Acrobat Forms API Reference
Header File
AF_ExpT.h
Related Methods
AFPDFieldSetFlags
SetFlagsAnnot Sets the bits in the flags to those that are 1s in the flagsparameter of AFPDFieldSetFlags.
ClrFlagsAnnot Clears the bits in the flags to those that are 1s in the flags
parameter of AFPDFieldSetFlags.
SetFlagsField Sets the bits in the flags to those that are 1s in the flagsparameter of AFPDFieldSetFlags.
ClrFlagsField Clears the bits in the flags to those that are 1s in the flagsparameter of AFPDFieldSetFlags.
FlagsIgnore Does not change any flags for the field or annotation.
-
8/11/2019 Form Sap i Reference
69/156
Acrobat Forms API Reference 69
AcroForm Declarations
AcroForm Data Types
AFPDFieldBorder
typedef AFPDWidgetBorderRecAFPDFieldBorder;
Description
Field Border data type.
Header File
AF_ExpT.h
Related Methods
AFLayoutBorderAFLayoutTextAFPDWidgetGetBorderAFPDWidgetSetBorder
-
8/11/2019 Form Sap i Reference
70/156
AcroForm Declarations
AcroForm Data Types
70 Acrobat Forms API Reference
AFPDFieldFlags_t
typedef ASUns32 AFPDFieldFlags_t;
Description
Used for the value of flags set by AFPDFieldSetFlags.
Header File
AF_ExpT.h
Related Methods
AFPDFieldSetFlags
-
8/11/2019 Form Sap i Reference
71/156
Acrobat Forms API Reference 71
AcroForm Declarations
AcroForm Data Types
AFPDWidgetBorder
AFPDWidgetBorderRec
typedef struct _AFPDWidgetBorderRec {AFPDWidgetBorderStylenStyle;ASInt32 nWidth;
} AFPDWidgetBorderRec; *AFPDWidgetBorder
Description
Form field appearance definitions for the outside border of an annotation.
Members
Header File
AF_ExpT.h
Related Methods
AFLayoutBorder
AFLayoutTextAFPDWidgetGetBorderAFPDWidgetSetBorder
nStyle Style of the border. Possible types are solid, dashed, beveled, inset,underline. See AFPDWidgetBorderStyle.
nWidth Width of the border.
-
8/11/2019 Form Sap i Reference
72/156
AcroForm Declarations
AcroForm Data Types
72 Acrobat Forms API Reference
AFPDWidgetBorderStyle
typedef enum {
AFPDWBSolid,AFPDWBDashed,AFPDWBBeveled,AFPDWBInset,AFPDWBUnderline,AFPDWPInvalid
} AFPDWidgetBorderStyle;
Description
Form field appearance definitions for the outside border of an annotation.
Values
Header File
AF_ExpT.h
Related Methods
AFLayoutBorder
AFPDWBSolid Strokes the entire perimeter of the widget with a solid line.
AFPDWBDashed Strokes the entire perimeter of the widget with a dashed line.
AFPDWBBeveled Equivalent to AFPDWBSolidstyle with an additional beveled(pushed-out appearance) border applied inside the solid
border.
AFPDWBInset Equivalent to AFPDWBBeveledstyle with an additionalbeveled (pushed-in appearance) border applied inside the
solid border.
AFPDWBUnderline Strokes the bottom portion of the widget with a underlinestyled line.
AFPDWBInvalid Do not change border.
-
8/11/2019 Form Sap i Reference
73/156
Acrobat Forms API Reference 73
AcroForm Declarations
AcroForm Data Types
ExportAsFDFParams
ExportAsFDFParamsRec
typedef struct _t_ExportAsFDFParams {ASSize_t size;AVDocavForm;PDDocpdForm;CosObjrgIncExcFlds;ASBoolbIncl;ASBoolbEmpty;ASBoolbExcludePasswd;ASBoolbCheckReqd;
ASAtomasaEncoding;ASPathNamefdfPath;char* submitBtnName;
} ExportAsFDFParamsRec;
Description
A parameter block used in the call to ExportAsFDFWithParams.
Members
size Size of the data structure. Must be set to sizeof(ExportAsFDFParamsRec).
avForm TheAVDocfor the form from which you want to export the data.You can pass NULLif the document does not have an AVDoc(that is, it is open only at the PD level).
pdForm ThePDDocfor the form from which you want to export the data.
-
8/11/2019 Form Sap i Reference
74/156
AcroForm Declarations
AcroForm Data Types
74 Acrobat Forms API Reference
rgIncExcFlds If rgIncExcFldsisCosNewNull, then all fields are exported,and bInclis ignored. If it is a CosArray, then the arrayelements may be:
Names of fields (the names may be of non-terminal fields,which is a fast and easy way to cause all their children to be
included in the FDF file).
Arrays, whose first element is a field name, and the rest of the
elements are field dictionary key names whose values should
be exported in the FDF file. For example, [(My listbox) /AP/Opt].
If rgIncExcFldscontains a single element, which is itselfan array as described in b) above, and its first element, which
corresponds to the field name, is NULL, then the FDF willinclude the requested field properties of all fields. Forexample: [ null /F /Ff ].
This variety ofrgIncExcFldsarray element can only be usedif bInclistrue.
bIncl If true, then rgIncExcFldsis an array of the fields to export.Otherwise, it is an array of the fields to exclude from exporting.
bEmpty If true, then all fields selected per the criteria above areexported. Otherwise, exclude those that have no value.
bExcludePasswd If true, will not include in the FDF text fields that have the"password flag set.
bCheckReqd If true, an alert pops up if any required field is empty.
asaEncoding Encoding to use in the produced FDF file for the value of the Ventry when it is a string. If ASAtomNullgets passed, thenExportAsFDFwill determine which encoding to use. IfPDFDocEncodingis passed, then do not do any encodingconversions and simply send Vas is (which means, as
PDFDocEncodingor Unicode).Other allowed values are Shift_JIS, BigFive, GBK, andUHC.
fdfPath Path where the FDF file will be saved (by the client) after it isproduced (by ExportAsFDFWithParams). You need this inorder to create an FDF file with an /Fkey that gives the relative
path to the form, from the location where the FDF file will besaved. Pass NULLif you want an absolute pathname.
-
8/11/2019 Form Sap i Reference
75/156
Acrobat Forms API Reference 75
AcroForm Declarations
AcroForm Data Types
Header File
AF_ExpT.h
Related Methods
ExportAsFDFWithParams
submitBtnName A NULL-terminated string containing the name of the buttonused to submit. If the value passed is not NULL, then the FDF filewill include a field dictionary corresponding to the submit
button, which will only contain one key, namely /T. This
dictionary is no different than the one you get when anAcroForm has an empty text field (that is, no Value), and
bEmptyistrue.
-
8/11/2019 Form Sap i Reference
76/156
AcroForm Declarations
AcroForm Data Types
76 Acrobat Forms API Reference
RetCode
typedef enum {
Good,Bad,Failed
} RetCode;
Description
A return code from functions.
Values
Header File
AF_ExpT.h
Related Methods
AFPDFieldSetOptions
Good Indicates success.
Bad Indicates possible parameter problem or other exception.
Failed Indicates a failure.
-
8/11/2019 Form Sap i Reference
77/156
Acrobat Forms API Reference 77
AcroForm Declarations
AcroForm Data Types
TextAppearance
TextAppearanceP
typedef struct TextAppearance_t {ASFixed charSpacing;ASFixed wordSpacing;ASFixed horizontalScale;ASFixed leading;ASFixed textRise;ASFixed textSize;ASFixedMatrix textMatrix;PDColorValueRecstrokeColor;
PDColorValueRecfillColor;ASUns16 renderMode;ASUns16 quadding;ASAtombaseFont;ASAtomnameFont;
} *TextAppearanceP;
Description
A structure containing information about the text appearance of a field.
Members
charSpacing The spacing between characters.
wordSpacing The spacing between words.
horizontalScale Horizontal scale.
leading Leading.
textRise Text rise.
textSize Point size of text. When fixedZero, enables text autosizing.
textMatrix Font matrix.
strokeColor Pen color.
fillColor Fill color.
renderMode Mode.
quadding Text justification.
-
8/11/2019 Form Sap i Reference
78/156
AcroForm Declarations
AcroForm Data Types
78 Acrobat Forms API Reference
Header File
AF_ExpT.h
Related Methods
AFLayoutText
Related Macros
Init_TextAppearanceP
baseFont Default font name.
nameFont Current font name.
-
8/11/2019 Form Sap i Reference
79/156
Acrobat Forms API Reference 79
AcroForm Declarations
Core Data Types
Core Data Types
The following are data types from the Core API that are used in the AcroForms API.
PDColorSpace
Constants that specify the color space in which a color value is specified (for example, RGB
or grayscale).
Members
Related Structures
PDColorValue
PDDeviceGray Grayscale. Requires 1 valueentry to specify the color.
PDDeviceRGB RedGreenBlue color specification. Requires 3 valueentries to
specify the color.
PDDeviceCMYK CyanMagentaYellowBlack color specification. Requires 4valueentries to specify the color.
-
8/11/2019 Form Sap i Reference
80/156
AcroForm Declarations
Core Data Types
80 Acrobat Forms API Reference
PDColorValue
PDColorValueRec
Data structure representing a color.
typedef struct _t_PDColorValueRec {PDColorSpacespace;ASFixed value[4];
} PDColorValueRec, *PDColorValue;
Members
Related Structures