FloatingBox doesn't respect dimensions with HTMLFragments and multiple columns

Hello, my project requires HTML text to be placed at specific positions on a page and have specific sizes.


So, I am creating a floating box at specific x/y co-ordinates and with specific dimensions. The floating box has multiple columns defined. If I add an HTMLFragment text I would expect it to start at the top of column 1, go down until the bottom of the floating box, then go back up to the top of the floating box and continue down column 2. etc.

That doesn’t seem to be happening. What seems to be happening is that the floating box is expanded downwards until it hits the bottom of the page - placing all the text in column 1- and only at that point does the text return to the top of the box and continue down column 2. It seems to ignore the height dimension of the floating box. I need it to respect the height dimension.

Also, if you place a floating box near to the bottom of the page with the above scenario (multiple columns etc.), I would expect if the text hits the bottom of the page, the floating box would be repeated at the top of the next page - that doesn’t seem to be happening either - what happens is that the floating box is repeated on the next page but its top position is the same as originally specified (ie near the bottom of the 2nd page). I would expect it to flow to the top of the next page.

Any ideas? I’ve included some code below. Many thanks, Ian.


Document doc = new Document();
doc.PageInfo.Margin.Left = 40;
doc.PageInfo.Margin.Right = 40;
Page page = doc.Pages.Add();

//define dimensions of floating box
Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox((float)page.PageInfo.Width,200);
box.ColumnInfo.ColumnCount = 2;
box.ColumnInfo.ColumnSpacing = “5”;
box.ColumnInfo.ColumnWidths = “150 150”;
box.Top = 190;
box.Left = 0;

//add border
Aspose.Pdf.BorderInfo border = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 1f, Aspose.Pdf.Color.Red);
box.Border = border;

//create large text
Aspose.Pdf.HtmlFragment text2 = new Aspose.Pdf.HtmlFragment(@“Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.”);
//add HTML Frag to floating box
box.Paragraphs.Add(text2);
//add floating box to page
page.Paragraphs.Add(box);

string outFile = @“c:\temp\output_empty.pdf”;
//Save the Pdf
doc.Save(outFile);

Hi Ian,


Thanks for using our API’s.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNET-41536 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

Thanks Nayyer. This would seem a fairly fundamental problem with the whole floating box paradigm and a fix for this would be greatly appreciated!


Thanks, Ian.

Hi Ian,


We will surely consider fixing this issue as quickly as possible and as soon as we have some definite updates, we will let you know.

The issues you have found earlier (filed as PDFNET-41536) have been fixed in Aspose.PDF for .NET 19.7.