Pages & sections
Every Vyuh Document contains one or more DocumentSection entries. Each section owns a SectionFormat that governs physical page geometry, margins, background color, borders, watermarks, column layout, headers, footers, and numbering.
- Included in: All configurations (paged features apply in
DocumentEditorLayoutMode.paginated) - Pure-Dart import:
package:vyuh_document/types.dart/package:vyuh_document/vyuh_document.dart - Layout mode: Choose
DocumentEditorLayoutMode.paginated(default) orDocumentEditorLayoutMode.pagelessonDocumentEditorController
Quick example
dart
final section = DocumentSection(
id: 'body',
format: SectionFormat(
pageWidth: 612, // US Letter (8.5 in × 72 pt)
pageHeight: 792,
orientation: PageOrientation.portrait,
margins: const PageMargins(
top: 72,
bottom: 72,
left: 72,
right: 72,
header: 36,
footer: 36,
),
pageColor: '#FFFFFF',
differentFirstPage: true,
watermark: const PageTextWatermark(
text: 'CONFIDENTIAL',
fontSize: 56,
color: '#94A3B8',
transparency: 0.75,
orientation: PageWatermarkOrientation.diagonal,
),
),
blocks: [/* ... */],
);What you can configure
SectionFormat
| Property | Type / Values | Purpose |
|---|---|---|
pageWidth, pageHeight | double (points) | Physical page dimensions (e.g. Letter 612 × 792, A4 595.28 × 841.89) |
orientation | PageOrientation (portrait, landscape) | Page orientation |
margins | PageMargins (top, bottom, left, right, header, footer, gutter) | Body insets, header/footer distances from page edge, and binding gutter |
pageColor | String? (hex) | Page background color rendered on screen and in PDF/DOCX |
pageBorders | PageBorders? (top, right, bottom, left, offsetFrom, display, zOrder) | Decorative borders around page edge or text area |
watermark | PageTextWatermark? (text, fontFamily, fontSize, bold, italic, color, transparency, orientation, rotationDegrees, layer) | Diagonal or horizontal background/foreground text watermark |
columns | Section column settings | Multi-column newspaper/magazine page flow with equal or custom column widths |
verticalAlignment | Vertical page alignment | Top, center, justified, or bottom distribution of content on pages |
differentFirstPage | bool | Enables distinct firstPageHeader and firstPageFooter on page 1 of the section |
pageNumbering | Page number format & start | Arabic, Roman, alphabetic numbering and custom start number per section |
lineNumbering | Line number configuration | Margin line numbers (continuous, restart per page, or restart per section) |
header / footer | PageHeaderFooter? | Running stories — see Headers and Footers |
Breaks
Insert hard structural breaks between pages, columns, or sections:
controller.insertPageBreak()— forces the next block onto a new page (PageBreak)controller.insertColumnBreak()— advances to the next section column (ColumnBreak)controller.insertSectionBreak()— starts a newDocumentSectionwith independent page setup (SectionBreakType)
Actions & commands
- Update section format:
controller.setSectionFormat(sectionIndex, nextFormat) - Page setup & layout actions:
DocumentActions.pageBreak,DocumentActions.columnBreak,DocumentActions.sectionBreak - Inspector: Selecting Page Setup in the workspace opens margins, orientation, size presets, page color, borders, and watermark controls.
Restricting usage
- Pageless mode (notes / forms / comments): Set
layoutMode: DocumentEditorLayoutMode.pagelessso content flows continuously without physical pages, margins, or running headers/footers. - Disable breaks: Exclude
PageBreak.elementandColumnBreak.elementfromDocumentConfiguration(for example withdocumentConfiguration.withoutElements([PageBreak.element, ColumnBreak.element])).
Format parity
| DOCX | HTML | Markdown | |
|---|---|---|---|
Full <w:sectPr> round-trip (size, margins, columns, borders, watermarks, breaks) | Exact paginated geometry identical to editor layout | Rendered with CSS page container & section dividers | Preserves body flow; page breaks export cleanly |