Moderators:TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan
Forum rules DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.
When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
can some one help me with how to replace text and save, I want to open PDF search for some text example Apple and replace it with Banana save the pdf and exit
Here's my current code, Any help or direction will be appreciated.
Public Sub CreateDoc()
Dim PXV As PDFXEdit.PXV_Inst
Dim pxc As New PDFXEdit.PXC_Inst
Dim Doc As IPXC_Document
Dim objdcb As IPXC_DocAuthCallback
Dim objContent As IPXC_Content
Dim retv() As Byte
Dim ar1(20) As String
Dim retv2 As IPXS_PDFVariant
Dim ts As IPXC_TState
Dim pf As PXC_PointF
Set PXV = New PDFXEdit.PXV_Inst
PXV.Init
Set pxc = PXV.GetExtension("PXC")
pxc.Init ""
Set Doc = pxc.OpenDocumentFromFile("Path\FP101A - Copy.pdf", Nothing)
Set objContent = Doc.Pages.Item(0).GetContent(CAccessMode_FullClone)
For i = 1 To objContent.Items.Count - 1
If objContent.Items.Item(i).Type = CIT_Text Then
Dim s() As String
Call objContent.Items.Item(i).Text_GetDataSA(retv())
Set retv2 = objContent.Items.Item(i).Text_GetData2()
For ir = LBound(retv) To UBound(retv)
sText = sText & Chr(retv(ir))
If sText = "SamplText" Then
MsgBox "Found: " & sText
'Replace "d" of "Approved" with the letter "N"
retv(3) = 65
Call retv2.Arr_SetInt(ir, 78)
Set ts = objContent.Items.Item(i).GetTState
'Set res = objContent.Items.Item(i).Text_SetData(retv2, ts) '<--- this line gives error Function not available in VB
End If
Next
Debug.Print sText
sText = vbNullString
End If
Next
Doc.WriteToFile "path\macroedited.pdf"
Doc.Close
pxc.Finalize
End Sub
All i want is to edit the text and save pdf back is it possible i have the content item I am looking for I need to edit that content item text and save the pdf that's it.
Just to clarify, are you using one of our SDK products for this task, or are you just trying to apply VBA actions to the end-user Editor?
If the former (using an SDK product), there may be a way you could develop something on your own to perform this task, but it would not be something our Dev team can build for you. If the latter, and you are using the end user editor, this is very likely not possible at this time, considering we do not yet offer our own Find and Replace function either.
We are looking to add Find and replace in the future, but for the time being, we do not have a solution in house to offer for replacement of base content text.
Kind regards,
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD
+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com