Adding TextStamp in Aspose.Pdf causes IndexOutOfRangeException

Can you confirm that the following code snippet does’t work in Aspose.Pdf for .NET 11.4.0:

TextStamp textStamp = new TextStamp("[TEST]")
{
Background = false, //set whether stamp is background
XIndent = 15, //set origin
YIndent = 15,
Rotate = Rotation.on90 //rotate stamp
};

//set text properties
textStamp.TextState.Font = FontRepository.FindFont(“Tahoma”);
textStamp.TextState.FontSize = 14.0F;
textStamp.TextState.FontStyle = FontStyles.Bold;
textStamp.TextState.FontStyle = FontStyles.Italic; // cause of IndexOutOfRangeException
textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
//add stamp to particular page
foreach (Page page in aPdfDocument.Pages)
{
page.AddStamp(textStamp); // IndexOutOfRangeException
}

Thanks in advance
Alex

Hi Alex,


Thanks for using our API’s.

I have tested the scenario and have managed to reproduce IndexOutOfRangeException when setting FontStyle as Italic. For the sake of correction, I have logged it as PDFNEWNET-40519 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNET-40519) have been fixed in Aspose.PDF for .NET 24.2.