We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is there another way to delete a text?

Hi All,

I currently take the following code to delete page number from a pdf.

Is there other way to do the same thing?

'Move old page number

Dim contentEditor As New Aspose.Pdf.Facades.PdfContentEditor()

'bind input PDF file


'make sure the regular expression strategy is being used

contentEditor.ReplaceTextStrategy.IsRegularExpressionUsed = True

'specify that you want to replace all the matching string

'by default only the first string will be replaced

contentEditor.ReplaceTextStrategy.ReplaceScope = Aspose.Pdf.Facades.ReplaceTextStrategy.Scope.REPLACE_ALL

'replace any string like 5467-3986-7 with new string

contentEditor.ReplaceText("[0-9.]*[A-Z.]*[a-z.]*[ ]*Page [0-9]+ of [0-9]+", String.Empty)

'save output PDF file




You may consider following the instructions specified over given below links for required information on how to

In case you require any further information, please feel free to contact.

By your sugesstion, in the matter of fact, the following code dosen't work. Can you check if there is something wrong with the following code? Thanks.

'open document

Dim inputFile As String = Current.Session("SendDir") + midFileName

'Dim pdfDocument As New Aspose.Pdf.Document(inputFile)

Dim pdfDocument As New Document(inputFile)

'create TextAbsorber object to find all instances of the input search phrase

Dim textFragmentAbsorber As New TextFragmentAbsorber("[0-9.]*[A-Z.]*[a-z.]*[ ]*Page [0-9]+ of [0-9]+") 'like 1999-2000

'set text search option to specify regular expression usage

Dim textSearchOptions As New TextSearchOptions(True)

textFragmentAbsorber.TextSearchOptions = textSearchOptions

'accept the absorber for all the pages


'get the extracted text fragments

Dim textFragmentCollection As TextFragmentCollection = textFragmentAbsorber.TextFragments

'loop through the fragments

For Each textFragment As TextFragment In textFragmentCollection

'update text and other properties

textFragment.Text = " " 'ERROR: Object reference not set

Next textFragment