-
Notifications
You must be signed in to change notification settings - Fork 0
PrintPreviewPages
317jamtay317 edited this page Jul 24, 2026
·
2 revisions
The Print Preview's pages: the given document paginated for real — by WPF's own
DocumentPaginator, the same pagination Print hands to the printer — into a vertical stack of
Pages at the Page Setup's oriented size and Print Margins (INV-061). Unlike the
Document Sheet, whose Page Breaks only mark boundaries without
repaginating, each page here holds exactly the content the printed page would.
-
Class:
UI.Controls.PrintPreviewPages(derives fromSystem.Windows.FrameworkElement) -
Hosted by:
PrintPreviewWindow, on a scrolling canvas beside its Print action, with its state inPrintPreviewViewModel -
Shown through: the
IPrintPreviewport (WindowPrintPreview), which the MarkdownRichEditor'sPrintPreviewrouted command (Ctrl+Shift+P) reaches after re-projecting the whole Markdown source — so a Folded Section's hidden body is previewed too (INV-034)
-
True pagination. The document is given the Page Setup's oriented
PageWidth/PageHeightand its Print Margins asPagePadding, then laid out by its ownDocumentPaginator—ComputePageCountfollowed byGetPageper page. This is the very layoutPrintDialog.PrintDocumentprints, so the preview cannot disagree with the printer. - One visual per Page. Each page is hosted as a paper rectangle (white, with a gray edge — paper is paper whatever the theme, because the preview shows the printout, not the editor) with the paginator's page visual over it, stacked vertically with a band of canvas between pages.
-
Re-paginates on change. Setting
DocumentorSetupclears the stack and paginates afresh. - Presentation-only. The document handed over is self-contained — freshly projected, never the live editing surface — so previewing changes nothing (INV-061).
| Property | Type | Description |
|---|---|---|
Document |
FlowDocument |
The self-contained document to paginate and preview. |
Setup |
PageSetup |
The Page Setup the pages are laid out under. Left unset, the default (Portrait, Normal margins) applies (INV-061). |
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"
Background="{DynamicResource EditorCanvasBrush}">
<controls:PrintPreviewPages Document="{Binding Document}" Setup="{Binding Setup}"
Margin="28" HorizontalAlignment="Center" />
</ScrollViewer>The window it lives in is opened through the port, never constructed directly:
// MarkdownRichEditor, on the PrintPreview routed command:
var document = _projector.Project(Markdown, BaseDirectory);
PrintPreview.Show(document, PageSetup ?? PageSetup.Default, "LiveMarkDownEditor document");LiveMarkDownEditor
User guide
- Getting Started
- Writing and Formatting
- Tables
- Diagrams
- Files, Folders and Tabs
- Finding and Navigating
- Panels and Layout
- Live Updates and Conflicts
- Pages, Printing and Export
- Spell Check
- Keyboard Shortcuts
Controls
- MarkdownRichEditor
- PageView
- DocumentSheetBackdrop
- PrintPreviewPages
- EditorGutter
- SourceGutter
- OutlinePanel
- FolderPanel
- PanelHeader
- PanelColumn
- CommandBarPanel
- CommandTip
- FindHighlightAdorner
- SpellCheckAdorner
- CodeShadingAdorner
- ChangeHighlightAdorner
- MermaidPreview
- MermaidDiagramView
- DiagramCanvas
- VideoPlayerView