ActivePDF
Shopping Cart My Account Help Contact Us
Request a Call
Search
Products Solutions Support Downloads Corporate
Submit an Issue
Knowledge Base
Server Product Support
Examples & How-Tos
Support Options
Support Policies
Annual Subscription
Extensions
Documentation
Resource Links
   
 
 
 
 

HomeSupportKnowledge Base
 
activePDF KB #11917 - Form Field Alignment
activePDF KB #11917 - Form Field Alignment
Information: Example Printer Version | Return to Search
Form Field Alignment
 
Product Version Code Samples    
Toolkit Pro
3.5.2
4.0
3.8.6
VBS
C#
 
Description
 
The following download contains an example demonstrating how to set a field's text alignment to centered, left, right, or fully justified. When changing field properties, it is necessary to temporarily store the field data, as shown in the example, then add the data again with SetFormFieldData once the properties have been set. The call to CopyForm will then propagate the changes to the new output file.

NOTE: This example is available in other scripts. Select from the Code Samples list above to display the download link for the example in the language appropriate for your programming environment.

Click below to download this example for VBScript. Download contains all required files




' Variables
' Template and Output files
varRightJustifiedFile = "right.pdf"
varInputFile = "input.pdf"

' Populate data variables
varField = "field"

' Instantiate Object
Set TK = CreateObject("APToolkit.Object")

' OpenOutputFile
varReturn = TK.OpenOutputFile(varRightJustifiedFile)
If varReturn <> 0 Then Error("OpenOutputFile") End If

' OpenInputFile
varReturn = TK.OpenInputFile(varInputFile)
If varReturn <> 0 Then Error("OpenInputFile") End If

' Store the data in the field who's alignment you are changing.
fieldData = TK.GetFormFieldDataByName(varField)

' Set the field's alignment to right justified
Set FIO = TK.FieldInfo(varField, 1)
FIO.Alignment = 2 'Left = 0, Centered = 1, and full justification = 3

' Set the field data
TK.SetFormFieldData varField, fieldData, 1

' CopyForm
varReturn = TK.CopyForm (0, 0)
If varReturn <> 1 Then Error("CopyForm") End If

' CloseOutputFile
TK.CloseOutputFile
TK.CloseInputFile
 
Keywords
 
Alignment, Justification, left, right, centered
 
Last Updated 2008-02-19 Printer Version | Return to Search
 
Knowledge Base Article Feedback*
*KB article feedback ONLY (submit support issues here)
Quality of this article?
  Poor Excellent 
1 2 3 4 5 6 7 8 9 10
Is this article helpful? Yes       No       Maybe
Comments (Optional)
Email Address (Optional)
Please enter the word "PDF"
(without quotes)
 
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
2003 activePDF Site Map Feedback Privacy Policy Legal