How to select and delete a text box from ...

This is a read only forum. It contains the most frequently asked questions about Amyuni products and licensing.
Post Reply
Amyuni Team
Posts: 113
Joined: Wed Sep 11 2002
Location: Montreal.

How to select and delete a text box from ...

Post by Dany » Fri Aug 05 2005

a pdf document using the developer version of the PDF Creator?

Here is a VB sample to do so:

Private Sub cmdDeleteObject_Click()
Dim obj As Variant
Dim objarray As Variant

'New for version 1.50
PDF1.SetLicenseKey LicenseTo, ActivationCode
PDF1.Open "c:\temp\test.pdf", ""

'Put report into RunState
'PDF1.ReportState = acReportStateRun

'get an array of all objects in Page[1]
objarray = PDF1.ObjectAttribute("Pages[1]", "Objects")

'Find and Delete object named "Unlicensed 4"
For Each obj In objarray
If obj.Attribute("Name") = "Unlicensed 4" Then

' Deletes an object referenced by the Object parameter from the PDF document. CanUndo should be set to True if the user is allowed to undo the delete object action, this is usually the case when this function is called from a menu or other user interface. CanUndo should be set to False if the user cannot undo this action, this is more efficient and avoids the overhead related to managing the Undo list.

PDF1.DeleteObject "Unlicensed 4", 0
'This fucntion enables the changes
PDF1.DoCommandTool (acCommandToolRunDocument)
End If
'Save file
PDF1.Save "c:\temp\delete.pdf", 0
End Sub

Post Reply