activePDF KB #10681 - Edit form field properties using Toolkit 4.0 Professional
activePDF KB #10681 - Edit form field properties using Toolkit 4.0 Professional
Edit form field properties using Toolkit 4.0 Professional
Product
Version
Code Samples
Toolkit Pro
4.0 4.0 SR1
VBS C# ASP
Description
The following VBScript example demonstrates how to edit individual form field properties using the Toolkit 4.0 Professional Edition's PDFFieldInfo object.
These files are required:Template.PDF - The template containing form fields for use as the input PDF.Field-EditProperties.vbs - Code detail provided below.
Click here to download this example (includes required files) :
' Variables
' Template and Output files
varOutputFile = "output.pdf"
varInputFile = "template.pdf"
' Field to edit variables
varField = "field"
varFieldInstance = "1"
' Field settings
varBackgroundColor = "#EEEEEE"
varBorderColor = "#000000"
varTextColor = "#FF9966"
varFontName = "Courier"
varFontSize = 10
varName = "NewField"
varValue = "Hello World"
' Instantiate Object
Set TK = CreateObject( "APToolkit.Object" )
' OpenOutputFile
varReturn = TK.OpenOutputFile( varOutputFile)
If varReturn <> 0 Then Error ( "OpenOutputFile" ) End If
' OpenInputFile
varReturn = TK.OpenInputFile( varInputFile)
If varReturn <> 0 Then Error ( "OpenInputFile" ) End If
' Select the field to change
Set FIO = TK.FieldInfo( varField, varFieldInstance)
' Set the field properties
FIO.BackgroundColor = varBackgroundColor
FIO.BorderColor = varBorderColor
FIO.Color = varTextColor
FIO.FontName = varFontName
FIO.FontSize = varFontSize
FIO.Name = varName
FIO.Value = varValue
' Release the field info object
Set FIO = Nothing
' CopyForm
varReturn = TK.CopyForm ( 0 , 0 )
If varReturn <> 1 Then Error ( "CopyForm" ) End If
' CloseOutputFile
TK.CloseOutputFile
' Release Object
Set TK = Nothing
' Done
Msgbox "Success!"
' Error Handling
Sub Error ( Method)
Msgbox "'" & Method & "' failed with a '" & varReturn & _
"'" & VBCRLF & "TK Return Codes:" & VBCRLF & _
"http://www.activepdf.com/support/kb/?id=10670&tk=ts"
Set objTK = Nothing
Wscript.Quit
End Sub
Keywords
edit, change, configure, field, form, parameters, alter, color, border, how, to, fieldinfo, info, pdffieldinfo, 4, requires, method, property, methods, properties, pdf, pdfs, VBS, VBScript, vb, script, example, create, from, html, text, method, property
The information in this article is for the use of activePDF Customers and Evaluation Users Only. No part of this document may be transmitted or reproduced without the express written consent of activePDF.
Copyright © 2005, activePDF, Inc. All Rights Reserved