I am trying to put TextStamp on a PDF file. I can render the PDF successfully, but I noticed that characters with descenders (e.g.: q, y, p, g, j) are being cut on the bottom part.
Here’s my code:
private void ApplyPdfWatermark(PdfFileInfo pdfFileInfo, string watermarkText)
{
TextStamp textStamp = new TextStamp(watermarkText);
textStamp.Background = false;
textStamp.Draw = true;
textStamp.RotateAngle = 45;
textStamp.Opacity = 0.30;
textStamp.OutlineOpacity = 0.30;
textStamp.TextState.Font = FontRepository.FindFont("Arial");
textStamp.TextState.FontSize = 24.0F;
textStamp.TextState.FontStyle = FontStyles.Bold;
textStamp.TextState.ForegroundColor = Color.FromRgb(System.Drawing.Color.FromArgb(255, 255, 255));
textStamp.TextState.StrokingColor = Color.FromRgb(System.Drawing.Color.FromArgb(0, 0, 0));
try
{
new License().SetLicense("Aspose.Pdf.lic");
for (int i = 1; i <= pdfFileInfo.NumberOfPages; i++)
{
textStamp.XIndent = pdfFileInfo.GetPageWidth(i) + 50;
textStamp.YIndent = 0;
for (int j = 0; j < (pdfFileInfo.GetPageWidth(i) / 15); j++)
{
textStamp.XIndent -= 110;
textStamp.YIndent -= 15;
pdfFileInfo.Document.Pages[i].AddStamp(textStamp);
}
}
}
catch (Exception e)
{
throw e;
}
}
And here’s a screenshot of what the issue looks like:
image.png (114.7 KB)