Skip to content

Configuration reference

Offprint resolves browser settings and a named capture profile before command dispatch. Use an explicit TOML configuration file when a repository or service owns the settings.

toml
default_profile = "research"

[browser]
source = "auto"
installation = "install-managed"
headless = true
maximum_contexts = 4

[profile.research]
verification = "offline"
missing_resources = "fail"
network_policy = "standard"

[profile.research.environment]
viewport = { width = 1440, height = 900, scale = 1 }
locale = "en-US"
timezone = "UTC"
color_scheme = "light"
reduced_motion = "reduce"

[profile.research.readiness]
mode = "render-idle"
network_quiet = "500ms"
mutation_quiet = "300ms"
lazy_load = "viewport-sweep"

[profile.research.limits]
duration = "2m"
frames = 256
resources = 10000
resource_bytes = "64MiB"
total_resource_bytes = "512MiB"
concurrent_resources = 8
artifact_bytes = "64MiB"
console
offprint doctor --config offprint.toml
offprint capture https://example.com \
  --config offprint.toml \
  --profile research \
  --output example.html

Precedence

Later sources override earlier sources:

  1. Built-in defaults and built-in profile
  2. User configuration in the platform configuration directory
  3. File selected by --config or OFFPRINT_CONFIG
  4. OFFPRINT_* environment variables
  5. Command flags

Profile selection follows --profile, OFFPRINT_PROFILE, explicit default_profile, user default_profile, then default.

The user configuration file is config.toml under the platform configuration directory:

PlatformDefault path
Linux$XDG_CONFIG_HOME/offprint/config.toml, or $HOME/.config/offprint/config.toml when XDG_CONFIG_HOME is unset
macOS$HOME/Library/Application Support/offprint/config.toml
Windows%APPDATA%\offprint\config\config.toml

Use --config PATH or OFFPRINT_CONFIG=PATH when the owning application needs an explicit, portable location.

Configuration files must be regular UTF-8 TOML files no larger than 1 MiB. Unknown keys and invalid values fail before command dispatch. Offprint does not load project-directory configuration automatically, which prevents an untrusted checkout from changing browser or network policy.

doctor --json reports selected operational values with provenance. The report is not a complete round-trip representation of every default, and its field paths are diagnostic names rather than canonical TOML keys.

Built-in capture profiles

ProfileMissing resourcesNetwork policyVerification
defaultwarnstandardoffline
strictfailstandardoffline
serverfailserveroffline

Define [profile.NAME] to add a profile. A custom profile begins with the normal defaults, then receives user and explicit file patches. In fluent Rust APIs, applying a profile replaces environment, readiness, content, network, limits, and verification values already set on the pending capture. Set per-capture overrides after applying the profile.

Browser settings

KeyType or valuesDefault
browser.sourceauto, managed, systemauto
browser.installationexisting-only, install-managedinstall-managed
browser.pathExecutable pathDiscovery
browser.cdp_urlHTTP, HTTPS, WS, or WSS URLUnset
browser.cache_dirDirectoryPlatform cache
browser.headlessBooleantrue
browser.maximum_contextsPositive integer4

Remote CDP requires network_policy = "unrestricted" and verification = "static". The caller owns remote endpoint and process trust.

Capture profile

KeyType or valuesDefault
verificationstatic, offlineoffline
missing_resourceswarn, failwarn
network_policystandard, server, unrestrictedstandard
preserve_password_valuesBooleanfalse
scopepage, selectionpage
selectorTop-level CSS selectorUnset
allowed_file_rootsArray of absolute rootsEmpty

Top-level headers and cookies keys can reference credential JSON files. Credential values remain outside TOML.

Optimization keys under [profile.NAME.optimizations] default to false:

  • remove_unused_css
  • remove_unused_fonts
  • remove_hidden_elements

Browser environment

Keys under [profile.NAME.environment]:

KeyDefault
viewport{ width = 1440, height = 900, scale = 1 }
locale"en-US"
timezone"UTC"
color_scheme"light"
reduced_motion"reduce"

The full Rust request also supports browser-default or overridden user-agent policy.

Readiness

Keys under [profile.NAME.readiness]:

KeyValues or default
moderender-idle, network-idle, load, dom-content-loaded. Default render-idle
network_quiet500ms
mutation_quiet300ms
delay0ms
lazy_loadviewport-sweep, disabled. Default viewport-sweep

Integer durations use milliseconds. String durations use ms, s, m, or h. A suffixless string is interpreted as seconds.

Limits

Keys under [profile.NAME.limits]:

KeyDefault
duration2m
redirects20
frames256
nodes1000000
resources10000
resource_bytes64MiB
total_resource_bytes512MiB
collector_chunk_bytes1MiB
concurrent_resources8
artifact_bytes64MiB
resource_recursion_depth64
frame_depth64

Byte values accept integers or strings using B, KiB, MiB, or GiB. Every limit except redirects must be greater than zero. Set redirects = 0 to reject the first redirect. total_resource_bytes must be at least resource_bytes. The compiled node maximum is one million.

Environment variables

AreaVariables
ConfigurationOFFPRINT_CONFIG, OFFPRINT_PROFILE
BrowserOFFPRINT_BROWSER_PATH, OFFPRINT_CDP_URL, OFFPRINT_CACHE_DIR, OFFPRINT_BROWSER_SOURCE, OFFPRINT_BROWSER_INSTALLATION, OFFPRINT_HEADLESS
Browser environmentOFFPRINT_VIEWPORT, OFFPRINT_LOCALE, OFFPRINT_TIMEZONE, OFFPRINT_COLOR_SCHEME
ReadinessOFFPRINT_TIMEOUT, OFFPRINT_WAIT_UNTIL, OFFPRINT_DELAY
ContentOFFPRINT_MISSING_RESOURCES, OFFPRINT_SCOPE, OFFPRINT_SELECTOR, OFFPRINT_REMOVE_UNUSED_CSS, OFFPRINT_REMOVE_UNUSED_FONTS, OFFPRINT_REMOVE_HIDDEN_ELEMENTS
TrustOFFPRINT_VERIFY, OFFPRINT_NETWORK_POLICY, OFFPRINT_HEADERS, OFFPRINT_COOKIES

Boolean values accept 1, true, or yes, and 0, false, or no. Unknown OFFPRINT_* names return offprint.config.field so automation cannot silently fall back to defaults.

Batch requests own complete capture settings. Most capture-profile environment variables do not rewrite requests loaded from a batch file.