Free Support Forum - aspose.com

ReplaceText and ReplaceImage on single PDF

Hi, I have a PDF with images and text that both require replacement. Aspose.pdf.kit will replace an image or text but won’t do both (after a BindPDF). It seems that whatever “Replace” method I use last is the one that takes. The call below only replaces the image. If I were to put ReplaceImage above the ReplaceText then the text will be replaced and not the image. Am I doing something wrong? Thanks!


Dim pdfCE As New PdfContentEditor
With pdfCE
.BindPdf(“C:\ASPOSE\Input.pdf”)

.ReplaceText("[title.s]", “Dodge Daytona”)
.ReplaceText("[description]", “This is a great car except for the paint.”)
.ReplaceText("[price.s]", “$5123”)
.ReplaceText("[telephone.s]", “555-555-5555”)

.ReplaceImage(1, 1, “C:\ASPOSE\db5.jpg”)

.Save(“C:\ASPOSE\PDF_OUTPUT\DaytonaOutput.pdf”)
End With
pdfCE.Close()
pdfCE = Nothing


Hi Scott,


Thanks for using our products.

I have tested the scenario using one of my sample PDF documents using Aspose.Pdf for .NET 7.4.0 and I am unable to notice any issue. Can you please try using v7.4.0 and in case the problem still persists, please share the source PDF file so that we can test the scenario at our end. We are sorry for this inconvenience.