Skip to content
ConsoleMonster
Cmdlet

Export-ConsoleFrame

Module
ConsoleMonster
Inputs
System.Object
Outputs
System.String System.Byte[] System.IO.FileInfo

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>]
#
Parameter set: All Parameter Sets

Description

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 Html

Export 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 @frameOptions

Export an SVG with a dark window frame

Parameters

-Background String optional
Slide background: Theme (default), Solid or Gradient.
Possible values: Theme, Solid, Gradient
-BackgroundColor String optional
Solid background or gradient start as #RGB or #RRGGBB.
-BackgroundEndColor String optional
Gradient end as #RGB or #RRGGBB; omitted uses the theme background.
-ChromeStyle WindowChromeStyle optional
None (default), MacOS, Windows or Linux. Choose a window style to show chrome; None hides it.
Possible values: MacOS, Windows, Linux
-Fit String optional
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[] optional
Additional raster font-family fallbacks, in preferred order.
-FontFamily String optional
Installed raster font; omitted uses embedded JetBrains Mono.
-FontSize Double optional
Natural-size font in pixels (default 14). Slide presets fit automatically, up to 72 pixels.
-Format String optional
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 optional
Height in cells for widgets (default: as tall as the widget measures).
-IndentationGuides SwitchParameter optional
Show themed scope or indentation guides in a single code view.
-InputObject Object requiredposition: 0pipeline: True (ByValue)
A widget, a rendered frame (CellBuffer), a live session, text, or objects to show as a table.
-LinesPerPage Int32 optional
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 optional
Maximum raster font size in pixels; default 72.
-NoCodeSource SwitchParameter optional
Omit the recoverable source normally embedded in an SVG code export.
-PassThru SwitchParameter optional
With -Path, also writes the file to the pipeline.
-Path String optionalposition: 1
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 optional
Graphics canvas: Docs, Slide16x9, Slide4x3 or Social.
Possible values: Docs, Slide16x9, Slide4x3, Social
-Theme ExportTheme optional
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 optional
The page title and, with a ChromeStyle other than None, the title bar text.
-Width Int32 optional
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.