Hi there,
When processing one of our documents we are getting the following exception:
System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
Parameter name: length
at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
at System.String.Substring(Int32 startIndex, Int32 length)
at Aspose.Pdf.Text.TextSegment.( , Int32 , Int32 , TextEditOptions )
at Aspose.Pdf.Text.TextSegment..ctor( , Int32 , Int32 )
at Aspose.Pdf.Text.TextFragmentAbsorber.( , [] )
at Aspose.Pdf.Text.TextFragmentAbsorber.Visit(Page page)
at Aspose.Pdf.Page.Accept(TextFragmentAbsorber visitor)
For other documents everything is fine.
Looks like Aspose.Pdf has problems with some PDF files ?
Can you elaborate on that ? or fix this bug.
You can use the code below + attached PDF file in order to reproduce the problem:
[Test]
public void SystemOutOfRangeErrorSample()
{
Document doc = new Document("Test.pdf");
int page = 0;
while (page < doc.Pages.Count)
{
page++;
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber();
Page processedPage = doc.Pages[page];
processedPage.Accept(textFragmentAbsorber);
}
}
Thanks in advance for your effort,
Wojtek