Skip to content
ComPDF
DemoSampleAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Developer FAQs

Q: How to set page orientation to landscape?

A: Swap width and height values when creating the page:

csharp
// Portrait A4: 595 x 842
CPage portraitPage = document.CreatePage(595, 842);

// Landscape A4: 842 x 595
CPage landscapePage = document.CreatePage(842, 595);

Q: How to implement multi-column layout?

A: Use tables or multiple divs with width settings:

csharp
CTable layout = page.CreateTable(2);
layout.UseAllAvailableWidth();
layout.SetBorderCollapse(CBorderCollapsePropertyValue.Collapse);

// Hide borders
using (CBorder noBorder = new CBorder(0))
{
    layout.SetBorder(noBorder);
}

layout.StartNewRow();
CCell leftColumn = layout.CreateCell();
CCell rightColumn = layout.CreateCell();

// Add content to each column
leftColumn.CreateText("Left column content");
rightColumn.CreateText("Right column content");