This example shows how to use eForm fields as placeholders for the insertion of text. In this example we simply replace each of the fields in a form with the name of that field.

 

   
Src
 
     

First we create an ABCpdf Doc object and read in our template form.

Set theDoc = Server.CreateObject("ABCpdf3.Doc")
theDoc.Read "c:\mypdfs\form.pdf"
theDoc.Font = theDoc.AddFont("Helvetica-Bold")
theDoc.FontSize = 16
theDoc.Rect.Pin = 1 ' top left

 

   
Dest
 
     

We ask the document root for a list of all the fields in the form and then split the list into an array.

theList = theDoc.GetInfo(theDoc.Root, "Field IDs")
theIDs = Split(theList, ",")

 

   
Add
 
     

We iterate through each of the fields in our list. For each field we get the field page and the field rectangle. We set the document page and rectangle so that we're drawing over the top of our annotation. We then color the rectangle light gray and draw the name of the field in dark red.

For i = 0 To UBound(theIDs)
  theID = theIDs(i)
  theDoc.Page = theDoc.GetInfo(theID, "Page")
  theDoc.Rect = theDoc.GetInfo(theID, "Rect")
  theDoc.Color = "240 240 255"
  theDoc.FillRect
  theDoc.Rect.Height = 16
  theDoc.Color = "220 0 0"
  theDoc.AddText theDoc.GetInfo(theID, "Name")
  theDoc.Delete theID
Next

 

   
Save
 
     

Finally we save.

theDoc.Save "c:\mypdfs\eform.pdf"

 

   
Results
 
     

Given the following document.


form.pdf

This is the kind of output you might expect.


eform.pdf

 

   

 

Browser Based Help. Published by chm2web software.