en Page Settings - ZeroHawkeye/wordZero GitHub Wiki
Page Settings
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.
📐 Page Dimensions
Standard Page Sizes
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)
Custom Page Dimensions
// 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
🔄 Page Orientation
Setting Orientation
// 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)
📏 Page Margins
Standard Margins
// 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
💡 Best Practices
1. Standard Sizes
- Use standard page sizes when possible
- Consider your target audience's preferences
- A4 for international, Letter for US documents
2. Margin Guidelines
- Minimum 20mm margins for most documents
- Add extra margin for binding if needed
- Consider printer limitations
Next Steps
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!