Hi there,
Thanks for your inquiry. You can use FormattedText object to add multiline text stamp. Please check following code snippet for the purpose. Moreover, can you please share the text with special characters that you are using as text stamp? So we look into it and provide you more information.
string newPath = (myDir + “WatermarkExample.pdf”);
FileStream ioStream = new FileStream(newPath, FileMode.Open, FileAccess.ReadWrite);
//open document
Document pdfDocument = new Document(ioStream);
FormattedText formatText = new FormattedText(“Sample stamp”, System.Drawing.Color.FromArgb(180, 0, 0), Aspose.Pdf.Facades.FontStyle.TimesItalic, EncodingType.Winansi, false, 20);
formatText.AddNewLineText("" + DateTime.Now.Date.ToShortDateString());
//create text stamp
TextStamp textStamp = new TextStamp(formatText);
//set whether stamp is background
// textStamp.Background = true;
//set origin
textStamp.XIndent = 100;
textStamp.YIndent = 100;
//rotate stamp
textStamp.RotateAngle = 45.0F;
//set text properties
textStamp.TextState.Font = FontRepository.FindFont(“Arial”);
textStamp.TextState.FontSize = 14.0F;
textStamp.TextState.FontStyle = FontStyles.Bold;
textStamp.TextState.FontStyle = FontStyles.Italic;
textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Aqua);
//add stamp to particular page
pdfDocument.Pages[1].AddStamp(textStamp);
//save output document
pdfDocument.Save();
Please feel free to contact us for any further assistance.
Best Regards,