I am writing content in two column using Aspose pdf FloatingBox.
The text is moving to next column only when page is ended and page space is wasted.
I want the text to be moved to next column so that we can use remaining page for other content.
Sample code:Aspose Output.png (73.3 KB)
Expected Output.png (126.7 KB)
string dataDir = @"C:\Users\sray18\PDF Creator\Temp\";
Document pdfDocument = new Document();
var page = pdfDocument.Pages.Add();
var colummWidth = (page.PageInfo.Width - (page.PageInfo.Margin.Left + page.PageInfo.Margin.Right + 80)) / 2;
FloatingBox box = new FloatingBox
{
ColumnInfo =
{
ColumnCount = 2,
ColumnSpacing = "80",
ColumnWidths = string.Join(" ", new double[2]{colummWidth, colummWidth})
},
};
TextFragment text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin=new MarginInfo(0,20,0,0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
text = new TextFragment("On the options front, maximum Put open interest stood at strike prices 9,700 and 9,800 while maximum Call OI was at 10,000 followed by 10,100. There was fresh Put writing at strike prices 9,000, 9,800 and 9,700 while fresh Call writing was seen at 9,900, 10,050 and 10,100. A shift in Put writing to higher levels suggests shifting of support while Call writing remained intact, which could restrict its immediate upside to 9,980-10,020 levels.");
text.Margin = new MarginInfo(0, 20, 0, 0);
box.Paragraphs.Add(text);
page.Paragraphs.Add(box);
pdfDocument.Save(dataDir + "Test.pdf");<a class="attachment" href="/uploads/default/6255">Expected Output.png</a> (126.7 KB)