Html 2 PDF "Index out of Bound Exception" (Urgent)


I am getting “Index out of Bound” Exception while generate html file from PDF. I am using below code.

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(sourcePath);
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
htmlOptions.FixedLayout = true;
htmlOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.AlwaysSaveAsTTF;
htmlOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
TextFragmentAbsorber textFragmentAbsorberForEmail = new TextFragmentAbsorber(@"\w+([-+.’]\w+)@\w+([-.]\w+).\w+([-.]\w+)*"); //like 1999-2000
//set text search option to specify regular expression usage
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorberForEmail.TextSearchOptions = textSearchOptions;
//accept the absorber for all the pages
//get the extracted text fragments
TextFragmentCollection textFragmentCollection = textFragmentAbsorberForEmail.TextFragments;
//loop through the fragments
foreach (TextFragment textFragment in textFragmentCollection)
string newText = string.Empty;
for (int counter = 0; counter < textFragment.Text.Length; counter++)
newText += “x”;
textFragment.Text = newText;
//textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.Black;
//textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.Black;
pdfDocument.Save(htmlFileName, htmlOptions);

Hi Jignesh,

Thanks for your inquiry. Please share your sample source document here, so we will test the scenario and will provide you more information accordingly.

Best Regards,