We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextStamp characters being cut at the bottom

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)

@markandrew.manoy

We were able to replicate the issue in our environment while using 22.12 version of the API. Therefore, it has been logged as PDFNET-53423 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

1 Like