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

Free Support Forum - aspose.com

How watermark text wrapping in pdf document using Aspose.pdt .net

hi Team,
how watermark text wrapping in pdf document using Aspose.pdt .net

my watermark text more then 100 character, how to wrap in two line in pdf document every page.

Below the sample coding we are using:

Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(“Aspose.Total.lic”);
string strwatermark = “Doc.no/Exe.No 1383 - PQ-TZ1-0029.01 Approved By Rick Manager [rick] Approved On 08/04/20 12:10:16 PM (IST) Testing by Rick manger and chennai location and testing on today”;
Aspose.Pdf.TextStamp textStamp = new Aspose.Pdf.TextStamp(strwatermark);
// Set whether stamp is background
textStamp.Background = true;
// Set origin
//textStamp.XIndent = 180;
//textStamp.YIndent = 40;
// Rotate stamp
{
textStamp.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Left;
textStamp.VerticalAlignment = Aspose.Pdf.VerticalAlignment.Center;
textStamp.Rotate = Aspose.Pdf.Rotation.on90;
textStamp.LeftMargin = 20;
}
        textStamp.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
        textStamp.TextState.FontSize = 12.0F;
        textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Blue);
        textStamp.WordWrap = true;
        Aspose.Pdf.Document wholePdf = new Aspose.Pdf.Document(@"D:\\FileTest\sample.pdf");
        foreach (Aspose.Pdf.Page page in wholePdf.Pages)
        {
            page.AddStamp(textStamp);
        }
        wholePdf.Save(@"D:\\FileTest\sample_1.pdf");

pls find the attachment for sample pdf document:
Sample Pdf.zip (42.0 KB)

@thiru1711

We were able to notice the issue in our environment while using Aspose.PDF for .NET 20.4 that word wrap was not working if text stamp was rotated. Hence, have logged an issue as PDFNET-47974 in our issue tracking system. We will look into its details and keep you informed with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.