How to create sections in hiqpdf and pageview layout (two pages view in single page ).
How to create sections in hiqpdf
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
How to create sections in hiqpdf and pageview layout (two pages view in single page ).
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Leon DRank #851 · 2.6K reputationPosted Jan 17, 2023, 10:08 PM EST
You can use Spire.PDF library to create sections in pdf and set page view layout.
https://www.e-iceblue.com/Download/download-pdf-for-net-now.html
Code sample:
using Spire.Pdf; using Spire.Pdf.Graphics; using System.Drawing; namespace CreateSections { class Program { static void Main(string[] args) { //Create a PDF document PdfDocument pdf = new PdfDocument(); PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", 11f)); //Add the first section PdfSection section1 = pdf.Sections.Add(); section1.PageSettings.Size = PdfPageSize.A4; section1.PageSettings.Margins = new PdfMargins(30); //Add a page to the first section PdfPageBase page1 = section1.Pages.Add(); //Draw some text on the page page1.Canvas.DrawString("This is Page 1", font, PdfBrushes.Black, 0, 50); //Add the second section PdfSection section2 = pdf.Sections.Add(); section2.PageSettings.Size = PdfPageSize.A4; section2.PageSettings.Margins = new PdfMargins(0); //Add a page to the section section PdfPageBase page2 = section1.Pages.Add(); //Draw some text on the page page2.Canvas.DrawString("This is Page 2", font, PdfBrushes.Black, 0, 50); //Set page layout pdf.ViewerPreferences.PageLayout = PdfPageLayout.TwoPageLeft; //Save the result document pdf.SaveToFile("Output.pdf"); System.Diagnostics.Process.Start("Output.pdf"); } } }