Page Setup
PageSetup controls orientation, paper size, margins, gutters, page borders, header/footer heights, and header/footer margins. It is exposed on bothVDocs.PageSettings and on each DocumentSection.
Basic Page Setup
Use case: Set a predictable default page size and margins for business documents.
C#
1using Vega;
2using Vega.DOM;
3using DOM.Enums;
4
5var doc = new VDocs();
6
7doc.PageSettings = new PageSetup
8{
9 PageSize = new PageSize(PaperSize.Letter),
10 Orientation = PageOrientation.Portrait,
11 Margin = new Margin(1.0, 1.0, 1.0, 1.0, Units.inch),
12 Gutter = new DocumentUnit(0.5, Units.inch),
13 HeaderHeight = 0.5,
14 FooterHeight = 0.5,
15};
Landscape with Custom Size
Use case: Use a wide layout for wide tables or diagrams.
C#
1doc.PageSettings = new PageSetup
2{
3 PageSize = new PageSize(11.0, 8.5, Units.inch),
4 Orientation = PageOrientation.Landscape,
5 Margin = new Margin(0.75, 0.75, 0.75, 0.75, Units.inch),
6};
Page Borders
Use case: Frame each page of a document with a decorative border.
C#
1doc.PageSettings = new PageSetup
2{
3 PageSize = new PageSize(PaperSize.A4),
4 Orientation = PageOrientation.Portrait,
5 Margin = new Margin(1.0, 1.0, 1.0, 1.0, Units.inch),
6 PageBorders = new PageBorders
7 {
8 Top = new BorderStyle { BorderColor = Color.DarkBlue, BorderSize = 2.0, BorderValue = BorderValues.double },
9 Bottom = new BorderStyle { BorderColor = Color.DarkBlue, BorderSize = 2.0, BorderValue = BorderValues.double },
10 Left = new BorderStyle { BorderColor = Color.Gray, BorderSize = 1.0, BorderValue = BorderValues.dotted },
11 Right = new BorderStyle { BorderColor = Color.Gray, BorderSize = 1.0, BorderValue = BorderValues.dotted },
12 DisplayValues = PageBorderDisplayValues.allPages,
13 OffsetFrom = PageBorderOffsetValues.text,
14 ZOrder = PageBorderZOrderValues.back
15 }
16};
Frequently asked questions
Where do I set margins — document or section?
Either. VDocs.PageSettings is document-wide; per-section values override them.
How do I change orientation mid-document?
Add a new section and set its PageSetup.Orientation (see the Sections topic).