Hello Mark,
Thanks for using our products.
In order to accomplish your requirement, set the value of IsNewPage property of second Section object to False. In order to have multiple columns in a section, you need to use ColunInfo class. Please take a look over the following code snippet and the resultant PDF that I have generated using Aspose.Pdf for .NET 4.6.0.
[C#]
//Instantiate Pdf instance by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Aspose.Pdf.Section Section1 = pdf1.Sections.Add();
Text sampletext = new Text("Sample text in section 1 which is Single Column");
sampletext.TextInfo.FontSize = 20;
sampletext.TextInfo.Color = new Aspose.Pdf.Color("Blue");
Section1.Paragraphs.Add(sampletext);
// Create a new section and add it to Pdf object
Aspose.Pdf.Section Section2 = pdf1.Sections.Add();
//Set the number of columns in the section to 2
Section2.ColumnInfo.ColumnCount = 2;
//Set the widths of the columns
Section2.ColumnInfo.ColumnWidths = "180 180";
//Set the spacing between the columns
Section2.ColumnInfo.ColumnSpacing = "5";
// Set the property value so that section is not displayed over second page
Section2.IsNewPage = false;
// Create a text object to be placed inside First column of second section
Text FirstColumnText = new Text("In magazines and newspapers, we mostly see that news are displayed in multiple columns on the single pages instead of the books where text paragraphs are mostly printed on the whole pages from left to right position. Many document processing applications like Microsoft Word and Adobe Acrobat Writer allow users to create multiple columns on a single page and then add data to them. Using Aspose.Pdf for .NET , developers can also add multiple columns to the pages of their PDF documents. As we know that we always add Paragraphs to Sections of our PDF documents using Aspose.Pdf for .NET . So, it is necessary to divide a Section into multiple columns and this is achieved by Section.ColumnInfo property, which is used to specify the column related information for each Section . This column information would include the width and spacing of columns etc. In magazines and newspapers, we mostly see that news are displayed in multiple columns on the single pages instead of the books where text paragraphs are mostly printed on the whole pages from left to right position. Many document processing applications like Microsoft Word and Adobe Acrobat Writer allow users to create multiple columns on a single page and then add data to them. Using Aspose.Pdf for .NET , developers can also add multiple columns to the pages of their PDF documents. As we know that we always add Paragraphs to Sections of our PDF documents using Aspose.Pdf for .NET . So, it is necessary to divide a Section into multiple columns and this is achieved by Section.ColumnInfo property, which is used to specify the column related information for each Section . This column information would include the width and spacing of columns etc. In magazines and newspapers, we mostly see that news are displayed in multiple columns on the single pages instead of the books where text paragraphs are mostly printed on the whole pages from left to right position. Many document processing applications like Microsoft Word and Adobe Acrobat Writer allow users to create multiple columns on a single page and then add data to them. Using Aspose.Pdf for .NET , developers can also add multiple columns to the pages of their PDF documents. As we know that we always add Paragraphs to Sections of our PDF documents using Aspose.Pdf for .NET . So, it is necessary to divide a Section into multiple columns and this is achieved by Section.ColumnInfo property, which is used to specify the column related information for each Section . This column information would include the width and spacing of columns etc.");
Section2.Paragraphs.Add(FirstColumnText);
//save the document
pdf1.Save(@"d:/pdftest/MultipleSections_SinglePage.pdf");
For more related information, please visit Manipulating Multiple Columns
I would also recommend you to visit the following thread to see the discussion over related topic. 188578
In case I have not properly understood your requirement or you have any further query, please feel free to contact.
Nayyer Shahbaz
Support Developer, Aspose Sialkot Team
About Us Contact UsKeep in touch! We're on
Twitter and
Facebook