-
Notifications
You must be signed in to change notification settings - Fork 42
en Page Settings
zero edited this page Jun 5, 2025
·
1 revision
WordZero provides comprehensive page layout and formatting options to control document appearance, margins, orientation, and page structure. This chapter covers page dimensions, margins, orientation, and advanced page configuration.
import "github.com/ZeroHawkeye/wordZero/pkg/document"
doc := document.New()
// A4 (default)
doc.SetPageSize(document.PageSizeA4)
// US Letter
doc.SetPageSize(document.PageSizeLetter)
// Legal
doc.SetPageSize(document.PageSizeLegal)
// A3
doc.SetPageSize(document.PageSizeA3)
// A5
doc.SetPageSize(document.PageSizeA5)// Set custom page size in millimeters
doc.SetCustomPageSize(210, 297) // A4 equivalent
// Set custom page size in inches
doc.SetCustomPageSizeInches(8.5, 11) // Letter equivalent
// Set custom page size in points
doc.SetCustomPageSizePoints(612, 792) // Letter equivalent// Portrait orientation (default)
doc.SetPageOrientation(document.OrientationPortrait)
// Landscape orientation
doc.SetPageOrientation(document.OrientationLandscape)
// You can also set size and orientation together
doc.SetPageLayout(document.PageSizeA4, document.OrientationLandscape)// Set all margins to the same value (in millimeters)
doc.SetMargins(25) // 25mm all around
// Set individual margins
doc.SetDetailedMargins(25, 25, 20, 20) // top, bottom, left, right
// Set margins in inches
doc.SetMarginsInches(1.0) // 1 inch all around- Use standard page sizes when possible
- Consider your target audience's preferences
- A4 for international, Letter for US documents
- Minimum 20mm margins for most documents
- Add extra margin for binding if needed
- Consider printer limitations
Continue learning about document structure:
- Advanced Features - Headers, footers, and page numbers
- Table Operations - Creating structured layouts
- Best Practices - Optimization techniques
Master page settings to create properly formatted documents!