Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ OfficeCLI is self-contained. The capabilities below ship inside the binary — *

#### Rendering engine — high-fidelity, built-in

OfficeCLI's keystone: a from-scratch, high-fidelity HTML rendering engine that lets an AI agent *see* the rendered document instead of guessing from the DOM. It covers shapes, charts (trendlines, error bars, waterfall, candlestick, sparklines), equations (OMML → LaTeX, rendered with KaTeX), 3D `.glb` models via Three.js, morph transitions, slide zoom, and shape effects. Per-page PNG screenshots are produced by piping the rendered HTML through a headless browser. Three modes:
OfficeCLI's keystone: a from-scratch, high-fidelity HTML rendering engine that lets an AI agent *see* the rendered document instead of guessing from the DOM. It covers shapes, charts (trendlines, error bars, waterfall, candlestick, sparklines), equations (OMML → LaTeX, rendered with KaTeX), 3D `.glb` models via Three.js, morph transitions, slide zoom, and shape effects. Per-page PNG screenshots are produced by piping the rendered HTML through a headless browser — found on PATH or in a platform-standard install location, or set `OFFICECLI_BROWSER=/path/to/chrome-family-binary` to point OfficeCLI at an explicit Chrome/Chromium/Edge executable outside those locations (e.g. a Chrome for Testing build a host manages itself). Three modes:

- **`view html`** — standalone HTML file, assets inlined. Open in any browser.
- **`view screenshot`** — per-page PNG, ready for multimodal agents to read.
Expand Down
7 changes: 7 additions & 0 deletions src/officecli/Core/HtmlScreenshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ private static (bool, string?) TryChrome(string url, string outPath, int w, int

private static string? FindChrome()
{
// Explicit override first: lets hosts that ship their own Chromium
// (e.g. a Chrome for Testing build outside the standard install
// paths) point OfficeCLI at it without touching PATH.
var explicitBrowser = Environment.GetEnvironmentVariable("OFFICECLI_BROWSER");
if (!string.IsNullOrWhiteSpace(explicitBrowser) && File.Exists(explicitBrowser))
return explicitBrowser;
Comment on lines +417 to +419

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prefer the explicit browser before Playwright

For view ... screenshot on a host with a working playwright CLI, this override is never honored: Capture() iterates Backends(), which tries Playwright before TryChrome, and returns immediately when Playwright succeeds. Consequently, operators cannot force the pinned Chrome-for-Testing executable described in the README whenever Playwright is installed; a valid OFFICECLI_BROWSER should make the Chrome backend run before automatic backend discovery while preserving the existing order when the variable is unset.

Useful? React with 👍 / 👎.


string[] names = ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser",
"chrome", "microsoft-edge", "microsoft-edge-stable", "msedge"];
var pathHit = WhichFirst(names);
Expand Down