Hi,
I'd like to know if there is a way to automatically select a specific object in the document. What I want to do is to "send to back" a specific object by using the DoCommandTool method. But my object has to be selected first
thanks
Daniel
Select an object
Hello Daniel,
I will post the same sample we send you here. When you modify it to send the object to back instead of deleting it you may post your own version here too.
' This sample select and delete a text box using VB.
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\sevepages_7.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
Next
'Save file
PDF1.Save "c:\temp\delete.pdf", 0
End Sub
I will post the same sample we send you here. When you modify it to send the object to back instead of deleting it you may post your own version here too.
' This sample select and delete a text box using VB.
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\sevepages_7.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
Next
'Save file
PDF1.Save "c:\temp\delete.pdf", 0
End Sub