Acro Form filed values can be set as they are merged into a new PDF document. This is done through the Form property of the Document class.
The value that is specified needs to match the export value for the form field. Unicode values are fully supported.
This example shows how to set the values on a merged Acro Form.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Dim MgOptions
Set MgOptions = Server.CreateObject( "DynamicPDF.MergeOptions" )
MgOptions.MergeFormFields = True
Dim MyArrString
ReDim MyArrString( 2 )
MyArrString( 0 ) = "ItemA"
MyArrString( 1 ) = "ItemC"
MyArrString( 2 ) = "ItemE"
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
MyDocument.LoadPdf Server.MapPath( "PDFs/ListBox1.pdf" ), , , MgOptions
' Set the field values
Dim MyListBox
Set MyListBox = MyDocument.Form.Fields.Item( "ListBox1" ) ' ListBox field
MyListBox.SetValues( MyArrString )
' Draw the PDF
MyDocument.DrawToWeb
Set MyDocument = Nothing
%>
Marking Acro Form Fields As Read Only
This example shows how to mark form fields as read only so that they can not be modified once they are set.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Dim MgOptions
Set MgOptions = Server.CreateObject( "DynamicPDF.MergeOptions" )
MgOptions.MergeFormFields = True
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
MyDocument.LoadPdf Server.MapPath( "PDFs/fw9AcroForm_03.pdf" ), , , MgOptions
' Set the field values
MyDocument.Form.Fields.Item( "f1-1" ).Value = "My Text" ' TextBox field
' Make the form read only
MyDocument.Form.IsReadOnly = True
' Draw the PDF
MyDocument.DrawToWeb
Set MyDocument = Nothing
%>
Filling Reorganized Acro Form Fields
This example shows how to set the values of reorganized Acro Form Fields.
[ASP - VBScript]
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490D-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Dim MgOptions
Set MgOptions = Server.CreateObject( "DynamicPDF.MergeOptions" )
MgOptions.MergeFormFields = True
MgOptions.RootFormField = "fw_9"
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
MyDocument.LoadPdf Server.MapPath( "PDFs/fw9AcroForm_03.pdf" ), , , MgOptions
' Set the field values
MyDocument.Form.Fields.Item( "fw_9.f1-1" ).Value = "John" 'or
MyDocument.Form.Fields.Item( 0 ).ChildFields.Item( "f1-1" ).Value = "John"
' Draw the PDF
MyDocument.DrawToWeb
Set MyDocument = Nothing
%>
| See Also |

