Create a TextBox on the 2nd or 3rd page using VB

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
Joseph
Posts: 2
Joined: Fri Aug 29 2003

Create a TextBox on the 2nd or 3rd page using VB

Post by Joseph »

I would like to put 7 fields on every page of the document. However I seem to be only able to put fields on the first page.

CurrentPage takes me to the page but when I CreateObject it still creates the Textbox on the first page.

This is the code I have written which does not work:

With Me.pdfCreator
For ii = 1 To .PageCount
.CurrentPage = ii
For i = 1 To 7
.CreateObject acObjectTypeText, "Unlicensed " & i
.ObjectAttribute("Unlicensed " & i, "Top") = 2000 * i
.ObjectAttribute("Unlicensed " & i, "Left") = 200
.ObjectAttribute("Unlicensed " & i, "Right") = 6000
.ObjectAttribute("Unlicensed " & i, "Text") = "Not registered!"
.ObjectAttribute("Unlicensed " & i, "TextColor") = &HFF
.RedrawObject "Unlicensed " & i
Next

Next
End With
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

Please look at the code below. This will resolve your issue.

Private Sub cmdAddSevenItems_Click()
Dim iCtrPage As Integer
Dim iCtrObj As Integer
iCtrPage = 1 'start at page 1

PDF1.SetLicenseKey LicenseTo, ActivationCode

With PDF1
For iCtrPage = 1 To 7

For iCtrObj = 1 To 7
.CreateObject acObjectTypeText, "Unlicensed " & iCtrObj
.ObjectAttribute("Unlicensed " & iCtrObj, "Top") = 2000 * iCtrObj
.ObjectAttribute("Unlicensed " & iCtrObj, "Left") = 200
.ObjectAttribute("Unlicensed " & iCtrObj, "Right") = 6000
.ObjectAttribute("Unlicensed " & iCtrObj, "Text") = "Not registered!"
.ObjectAttribute("Unlicensed " & iCtrObj, "TextColor") = &HFF
Next

If iCtrPage <= 6 Then
.AddPage iCtrPage
End If
Next
'This fucntion enables the changes
.DoCommandTool (acCommandToolRunDocument)
.Save "c:\temp\sevepages_7.pdf", 0
End With
End Sub

Hope this helps
Post Reply