Text Find and Replace
You can find and replace text within a PDF using IronPDF's Replace.
// PM> Install-Package IronPdf using IronPdf; // Using an existing PDF using PdfDocument myPdf = PdfDocument.FromFile("sample.pdf"); // Parameters int pageIndex = 1; string oldText = ".NET 6"; // Old text to remove string newText = ".NET 7"; // New text to add // Replace Text on Page myPdf.ReplaceTextOnPage(pageIndex, oldText, newText); // Save your new PDF myPdf.SaveAs("new_sample.pdf");
' PM> Install-Package IronPdf Imports IronPdf ' Using an existing PDF Private PdfDocument As using ' Parameters Private pageIndex As Integer = 1 Private oldText As String = ".NET 6" ' Old text to remove Private newText As String = ".NET 7" ' New text to add ' Replace Text on Page myPdf.ReplaceTextOnPage(pageIndex, oldText, newText) ' Save your new PDF myPdf.SaveAs("new_sample.pdf")
Install-Package IronPdf