Aspose Pdf Section Title - Trims when length exceeds - issue

Hi Team,

We are using Aspose.Total licensed version and streaming the input for Aspose.Pdf.Document. When the section title exceeds around 70 characters, the title is getting trimmed on left and right. Please check the attached file. When I give ParagraphFormat.CharacterUnitLeftIndent = 4, it is displaying the complete title, but the section content is missing. Please advise.Title Length issue - Aspose.pdf (71.8 KB)

@Kamalakaram

Would you kindly share the complete code snippet for our reference that we can use to replicate the issue in our environment? We will further proceed to assist you accordingly.

before title.PNG (30.9 KB)
after title.PNG (31.6 KB)

Please check the below lines:
Foo1 is the file before adding the title and Foo2 is the one after adding title. I attached the screenshots of these files for reference. The title in Foo2 is getting trimmed at the right.

Earlier in line number 7, it was like textStamp.HorizontalAlignment = HorizontalAlignment.Center; and the title was getting trimmed at both left and right. Later, I modified the line as HorizontalAlignment.Left.

doc2.Save(@"C:\\temp\Foo1.pdf");
FormattedText ft = new FormattedText("3 test excel 0123456789 0123456789 0123456789 0123456789 abcdefghijklmnopqrstuvwxyz", System.Drawing.Color.FromArgb(227, 23, 54), System.Drawing.Color.White, "Arial", EncodingType.Cp1250, false, 14.99f);
TextStamp txtStamp = new TextStamp(ft);
// Set properties of the stamp
txtStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold;
txtStamp.TopMargin = 10;
txtStamp.HorizontalAlignment = HorizontalAlignment.Left;
//txtStamp.WordWrap = false;
txtStamp.VerticalAlignment = VerticalAlignment.Top;
// Add header on all pages
Page pdfpage = doc2.Pages[1];
pdfpage.AddStamp(txtStamp);
doc2.Save(@"C:\\temp\Foo2.pdf");

before title.PNG (30.9 KB)
after title.PNG (31.6 KB)

@Kamalakaram

Please try to use the below code snippet and let us know in case you still notice any issues. We have attached a generated output for your kind reference as well:

var doc2 = new Aspose.Pdf.Document(dataDir + "Title Length issue - Aspose.pdf");
Facades.FormattedText ft = new Facades.FormattedText("3 test excel 0123456789 0123456789 0123456789 0123456789 abcdefghijklmnopqrstuvwxyz", System.Drawing.Color.FromArgb(227, 23, 54), System.Drawing.Color.White, "Arial", Facades.EncodingType.Cp1250, false, 14.99f);
TextStamp txtStamp = new TextStamp(ft);
// Set properties of the stamp
txtStamp.TextState.FontStyle = Aspose.Pdf.Text.FontStyles.Bold;
txtStamp.TopMargin = 10;
txtStamp.HorizontalAlignment = HorizontalAlignment.Left;
txtStamp.VerticalAlignment = VerticalAlignment.Top;
txtStamp.WordWrap = true;
txtStamp.Width = doc2.Pages[1].GetPageRect(true).Width;
// Add header on all pages
Page pdfpage = doc2.Pages[1];
pdfpage.AddStamp(txtStamp);
doc2.Save(dataDir + "Foo2.pdf");

Foo2.pdf (75.3 KB)