Free Support Forum - aspose.com

Right-aligned tabstop with line breaks bug

Hi,

Using Aspose.Pdf 3.6.1.0, I’ve got a bug with right-aligned tabstops and line break. Whenever I use a multi-line text paragraph with a right-aligned tabstop and “\n” to break lines, only the last line has the correct tabstop, all others are “too left”.

Any ideas ?

Thanks a lot,

Dominic.

The following code to illustrate the problem:

Aspose.Pdf.Pdf pdfDocument = new Aspose.Pdf.Pdf();
Aspose.Pdf.Section pdfSection = pdfDocument.Sections.Add();

Aspose.Pdf.Text pdfText;
Aspose.Pdf.Segment pdfSegment;

pdfText = new Aspose.Pdf.Text();
pdfSection.Paragraphs.Add(pdfText);

pdfText.TabStops = new Aspose.Pdf.TabStops();
Aspose.Pdf.TabStop pdfTabStop = pdfText.TabStops.Add();
pdfTabStop.Position = 100 * MM2PT;
pdfTabStop.AlignmentType = Aspose.Pdf.TabAlignmentType.Right;

// Line 1
pdfSegment = new Aspose.Pdf.Segment(“Left text 1”);
pdfText.Segments.Add(pdfSegment);

pdfSegment = new Aspose.Pdf.Segment("\tRight text 1");
pdfText.Segments.Add(pdfSegment);

// Line 2
pdfSegment = new Aspose.Pdf.Segment("\nLeft text 2");
pdfText.Segments.Add(pdfSegment);

pdfSegment = new Aspose.Pdf.Segment("\tRight text 2");
pdfText.Segments.Add(pdfSegment);

// Line 3
pdfSegment = new Aspose.Pdf.Segment("\nLeft text 3");
pdfText.Segments.Add(pdfSegment);

pdfSegment = new Aspose.Pdf.Segment("\tRight text 3");
pdfText.Segments.Add(pdfSegment);

pdfDocument.Save(“c:\temp\pdfTest.pdf”);

Hi,

I have tested the code and was able to reproduce the error. I have logged this as PDFNET-4183. We will try to solve this as soon as possible.

Thanks.

Hi,

The new hot fix Aspose.Pdf 3.6.2.0 has been published and the fix of PDFNET-4183 is included. Please download it follow this link: http://www.aspose.com/Community/Files/
Thanks.

Best regards.