PDF Multi-columns wrong position

The textfragments in the second column in Pdf is shown in wrong position.

I am using Aspose.Pdf for .Net v 10.7.0
Please refer to the code below.

var doc = new Document();

var page = doc.Pages.Add();

var box = new Aspose.Pdf.FloatingBox
{
ColumnInfo =
{
ColumnCount = 2,
ColumnSpacing = “50”,
ColumnWidths = “200 200”
}
};

var text1 = new TextFragment(@“Column 1”);

box.Paragraphs.Add(text1);

text1.TextState.FontStyle = FontStyles.Italic;

var text2 = new TextFragment(@“Column 2.”);

var text3 = new TextFragment(@“Column 2 as well.”);

text2.IsFirstParagraphInColumn = true;

box.Paragraphs.Add(text2);

box.Paragraphs.Add(text3);

page.Paragraphs.Add(box);

var outFile = @“C:\temp\Muli-Column.pdf”;
//Save the Pdf
doc.Save(outFile);

Hi Patrick,


Thanks for your inquiry. Please add TextSegments into TextSegment of a column instead creating new TextSegment. Please check following code, hopefully it will help you to accomplish the task. It there is some difference in your requirement then please share an intended sample document to exhibit the requirements.

…<o:p></o:p>

....

var text2 = new TextFragment(@"Column 2.");

// var text3 = new TextFragment(@"Column 2 as well.");

var text3 = new TextSegment(Environment.NewLine);

var text4 = new TextSegment(@"Column 2 as well.");

text2.Segments.Add(text3);

text2.Segments.Add(text4);

text2.IsFirstParagraphInColumn = true;

box.Paragraphs.Add(text2);

....

....

Please feel free to contact us for any further assistance.


Best Regards,