Export-ConsoleFrame
Exports a widget, a rendered frame or a live-session snapshot to PNG, HTML, SVG, Markdown or text.
Syntax
Export-ConsoleFrame
[-Background <Theme| Solid| Gradient>]
[-BackgroundColor <String>]
[-BackgroundEndColor <String>]
[-ChromeStyle <MacOS| Windows| Linux>]
[-Fit <Content| Terminal>]
[-FontFallbacks <String[]>]
[-FontFamily <String>]
[-FontSize <Double>]
[-Format <String>]
[-Height <Int32>]
[-IndentationGuides]
[-InputObject] <Object>
[-LinesPerPage <Int32>]
[-MaxFontSize <Double>]
[-NoCodeSource]
[-PassThru]
[[-Path] <String>]
[-Preset <Docs| Slide16x9| Slide4x3| Social>]
[-Theme <Auto| Dark| Light| HighContrast| Current>]
[-Title <String>]
[-Width <Int32>]
[<CommonParameters>]#All Parameter SetsDescription
Pipe any New-Console* widget (or New-ConsoleTable) and get a self-contained HTML page (inline CSS, selectable text, a dark and a light rendering that follow the viewer's prefers-color-scheme), an SVG image (box, block and braille characters drawn as shapes, selectable text, no external assets) or plain text. Cell geometry is kept exactly. OSC 8 links become links (web and mail links only; javascript: and other schemes are dropped). Markdown uses the bundled ConsoleMonster.Markdown add-on lazily: tables, records and trees retain their semantics; FencedText preserves the terminal layout. Other objects use their registered module view when available and otherwise use the automatic view. Several widgets are stacked. Without -Path the document is written to the pipeline.
Examples
Example 1
Get-Process | Select-Object -First 8 Name, Id | New-ConsoleTable | Export-ConsoleFrame -Format HtmlExport a table as an HTML page
Example 2
$frameOptions = @{
Format = 'Svg'
Width = 120
Height = 36
Theme = 'Dark'
Title = 'Nightly run'
ChromeStyle = 'MacOS'
}
$textOptions = @{
Text = @('Nightly run')
}
New-ConsoleText @textOptions | Export-ConsoleFrame @frameOptionsExport an SVG with a dark window frame
Parameters
- -Background String
- Slide background: Theme (default), Solid or Gradient.
- Possible values:
Theme,Solid,Gradient - -BackgroundColor String
- Solid background or gradient start as #RGB or #RRGGBB.
- -BackgroundEndColor String
- Gradient end as #RGB or #RRGGBB; omitted uses the theme background.
- -ChromeStyle WindowChromeStyle
- None (default), MacOS, Windows or Linux. Choose a window style to show chrome; None hides it.
- Possible values:
MacOS,Windows,Linux - -Fit String
- Slide fitting: Content trims unused rows and columns with two trailing columns of padding; Terminal keeps the complete grid. Animations use one stable size throughout the clip.
- Possible values:
Content,Terminal - -FontFallbacks String[]
- Additional raster font-family fallbacks, in preferred order.
- -FontFamily String
- Installed raster font; omitted uses embedded JetBrains Mono.
- -FontSize Double
- Natural-size font in pixels (default 14). Slide presets fit automatically, up to 72 pixels.
- -Format String
- The format: Png, Html, Svg, Markdown (semantic tables, records and trees), FencedText (a preformatted block) or Text (default: from the -Path extension, including .md/.markdown, else Html).
- Possible values:
Html,Svg,Text,Markdown,FencedText,Png - -Height Int32
- Height in cells for widgets (default: as tall as the widget measures).
- -IndentationGuides SwitchParameter
- Show themed scope or indentation guides in a single code view.
- -InputObject Object
- A widget, a rendered frame (CellBuffer), a live session, text, or objects to show as a table.
- -LinesPerPage Int32
- Split a single code view into pages of at most this many source lines. Page breaks try to keep source blocks together. Multiple files get numbered suffixes. A receipt beside the export lets a later export of the same view to this path remove obsolete, unedited pages. Without Path each page goes to the pipeline.
- -MaxFontSize Double
- Maximum raster font size in pixels; default 72.
- -NoCodeSource SwitchParameter
- Omit the recoverable source normally embedded in an SVG code export.
- -PassThru SwitchParameter
- With -Path, also writes the file to the pipeline.
- -Path String
- The file to write (binary PNG, or UTF-8 text without a byte order mark). Without it PNG bytes or the text document go to the pipeline.
- -Preset String
- Graphics canvas: Docs, Slide16x9, Slide4x3 or Social.
- Possible values:
Docs,Slide16x9,Slide4x3,Social - -Theme ExportTheme
- Auto (both HTML renderings), Dark, Light, HighContrast, or Current: the theme in use on the background it is made for. Without -Theme, Current is used when a theme was chosen (Set-ConsoleTheme, Set-ConsoleSetting Theme, CONSOLEMONSTER_THEME or the settings file), so the export looks like your terminal; otherwise Auto. Raster Auto uses Dark.
- Possible values:
Auto,Dark,Light,HighContrast,Current - -Title String
- The page title and, with a ChromeStyle other than None, the title bar text.
- -Width Int32
- Width in cells for widgets (default 0: terminal width, falling back to 100).
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.