Extract text from PDF using C# | Aspose.PDF for .NET | The slanted words gets errors

mypattern=“押题|www.yidingguo”
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(mypattern);

textFragmentAbsorber.TextSearchOptions.IsRegularExpressionUsed = true;
pdfDocument.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
RedactionAnnotation ra = new RedactionAnnotation(textFragment.Page, myrectange);

if (textFragment.TextState.Rotation!= 0){
textFragment.text="";
}

Error message:
System.ArgumentException: Invalid index: index should be in the range [1…n] where n equals to the operators count.
在 Aspose.Pdf.OperatorCollection.#=zNYeQGlZt2qRnhBAvhCHtAyg=(Int32 #=zTt58Pcs=)
在 #=zdcZDrO$CfWmPF8bE9CCticjG7Mqv1wgvMK1m7mbWZTTkn$VnWNy9NDc=.#=z__$VyYzMM53S(#=zzEXskTc= #=z_MIeuFI=)
在 #=zk_baTkeGsSyYK2fUlwbWQQdqJBHEBQqcIHGujE4wtcfm_Qaxg6hVLHA=.#=zCv358O0=(TextEditOptions #=zRGbBioo=)
在 Aspose.Pdf.Text.TextSegment.#=z$K9TIfjRNqx1()
在 Aspose.Pdf.Text.TextSegmentCollection.#=zCv358O0=(Int32 #=zTt58Pcs=)
在 Aspose.Pdf.Text.TextFragment.#=z65$gx016ti387NWqjPDln7Y=()
在 Aspose.Pdf.Text.TextFragment.set_Text(String value)
在 Aspose.Pdf.Examples.CSharp.AsposePDF.Text.ReplaceTextAll.Run(String mypattern, String filepath, String StepProc)
input.pdf (334.4 KB)

@tomgreen

While testing the scenario using the below code snippet and Aspose.PDF for .NET 21.4, we did not notice any issue. The API was able to extract both text from the PDF document:

Document doc = new Document(dataDir + "input.pdf");
foreach (var page in doc.Pages)
{
 var absorber = new TextFragmentAbsorber(@"押题|www.yidingguo")
 {
  TextSearchOptions = new TextSearchOptions(true)
 };
 page.Accept(absorber);
 Console.WriteLine(absorber.TextFragments[1].Text);
 Console.WriteLine(absorber.TextFragments[2].Text);
}

Would you please try using the latest version of the API and let us know in case you still face any issue.