Dim License As New Aspose.Pdf.License
License.SetLicense("\It1\IT\Automation\publish\Prerequisites\Aspose\Version 17.12\Aspose.Total.lic")
Dim pdf As Aspose.Pdf.Document = New Aspose.Pdf.Document(Path.Combine(PDFPath, SequenceStep.Sequence.CurrentFile.GetFileNameWithoutExtension & ".pdf"))
PDFfilename = Path.Combine(PDFPath, SequenceStep.Sequence.CurrentFile.GetFileNameWithoutExtension & ".pdf")
While Not MyReader.EndOfData
Dim TextFragmentAbsorberAddress As New Aspose.Pdf.Text.TextFragmentAbsorber()
TextFragmentAbsorberAddress.TextSearchOptions.LimitToPageBounds = True
TextFragmentAbsorberAddress.TextSearchOptions.Rectangle = New Aspose.Pdf.Rectangle(Specs(0), Specs(1), Specs(2), Specs(3))
**pdf.Pages(1).Accept(TextFragmentAbsorberAddress)**
For Each tf As Aspose.Pdf.Text.TextFragment In TextFragmentAbsorberAddress.TextFragments
If Not String.IsNullOrWhiteSpace(tf.Text) Then
tf.Text = ""
End If
Next
End While
pdf.Flatten()
pdf.Save(PDFfilename)
The above code has been working for us. The version we used was 9.9,0.0.
After I upgraded to version 17.12 the line:
pdf.Pages(1).Accept(TextFragmentAbsorberAddress) is now failing and the exception I am getting is:
{“Index was outside the bounds of the array.”}
This line of code has always worked for me.
I have to use the code above as our requirement is to clean only certain pages in the PDF document and not all pages.
Please help ASAP as it is holding up crucial release.
Thanks,
Shilpa Joshi