VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Text: Replace Text in PDF
  |  
Home ›› XDoc.PDF ›› C# PDF: Replace Text in PDF

VB.NET PDF - How to Replace Text in PDF File in VB.NET


VB.NET Programming Demo Code to Replace Text in PDF Document in VB.NET Class




Free VB.NET PDF SDK library for replacing PDF text in Visual Studio .NET application


Able to perform PDF text replacing in .NET WinForms and ASP.NET webpage


Find and replace text in PDF file in preview without adobe PDF reader component installed


Able to pull text out of selected PDF page or all PDF document in VB.NET


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Online .NET framework freeware download and VB.NET class source code


A Professional VB.NET PDF edit control compatible with Windows system


In document management system, users may have the need of replace content in PDF document, like text characters. And RasterEdge .NET PDF SDK is such a qualified solution that allows programmers to integrate mature text replacing functionality into VB.NET projects. Basically, you can use robust APIs to select a PDF page, define the text string, and replace it from PDF document.




How to Replace Text in PDF in VB.NET



Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;




VB.NET: Replace Text in PDF File


The following coding example illustrates how to perform PDF text replacing function in your VB.NET project, according to search option.




'Open a document
Dim doc As PDFDocument = New PDFDocument(inputFilePath)

'Set the search options
Dim options As RESearchOption = New RESearchOption()
options.IgnoreCase = False
options.WholeWord = True

'Replace "RasterEdge" with "Image"
doc.Replace("RasterEdge", "Image", options)
doc.Save("C:\\output.pdf")





VB.NET: Replace Text in Specified PDF Page


VB.NET demo code below will guide you how to replace text in specified PDF page.




'Open a document
Dim doc As PDFDocument = New PDFDocument(inputFilePath)

'Set the search options
Dim options As RESearchOption = New RESearchOption()
options.IgnoreCase = False
options.WholeWord = True

Dim pageIndex As Integer = 1

'Replace "RasterEdge" with "Image" in the second page
doc.Replace("RasterEdge", "Image", options, pageIndex)
doc.Save("C:\\output.pdf")





VB.NET: Replace Text in Consecutive PDF Pages


Demo code for replacing text in consecutive PDF page starting from specified page index for VB.NET.




'Open a document
Dim doc As PDFDocument = New PDFDocument(inputFilePath)

'Set the search options
Dim options As RESearchOption = New RESearchOption()
options.IgnoreCase = False
options.WholeWord = True

Dim pageOffset As Integer = 1
Dim pageCount As Integer = 2

'Replace "RasterEdge" with "Image" in the second and third pages
doc.Replace("RasterEdge", "Image", options, pageOffset, pageCount)
doc.Save("C:\\output.pdf")