/bidi2pdf:remote-chromefrom bidi2pdf
Sets up a shared chromedriver Docker container for bidi2pdf rendering, handling container configuration, session management, and troubleshooting render failures.
Ships in bidi2pdf. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
bidi2pdf talks to chromedriver over HTTP and WebDriver BiDi. A chromedriver container that several processes share is cheaper and more predictable than a browser per process, and keeps Chrome out of the application's own container.
Does not: cover Kubernetes or a cloud browser service, and does not make an untrusted page safe on its own (section 5 is what it takes).
error.code, error.hint and exit code;
never make the PDF or screenshot another way (Chrome's own print-to-PDF, another PDF engine).render-pdf skill's
preflight); run nothing that changes the system without the user's yes.--json result instead of inspecting the PDF with other
tools.references/compose.remote-chrome.yml is a working Compose service, taken from an application that
runs it in development and production. The parts that matter, and why:
dieters877565/chromedriver (chromedriver + Chromium, hyphenation dictionaries
included). It answers on port 3000; the new-session URL is http://<service>:3000/session.ENABLE_VNC: "false").CAP_SYS_ADMIN. Three ways, from the narrowest:
docker/chrome-driver/chrome.json (security_opt: ["seccomp=chrome.json"]), no extra capability. It allows the namespace calls Chrome uses, but
also some Docker's default refuses (mount, bpf, ptrace, perf_event_open); verify on your
host that sessions start before relying on it.cap_add: [SYS_ADMIN] - works with the default profile, and is what the reference file uses. It
is a broad capability: keep the container on its internal network and give it nothing else.--no-sandbox (DISABLE_CHROME_SANDBOX=true for the
CLI). Chrome then runs every page without its own sandbox - only for pages you trust. Some CI
runners drop --cap-add silently; there only this works.pids_limit: 1024, mem_limit: 2g with memswap_limit equal (no
swap: a Chrome out of memory is killed and replaced instead of freezing every render),
shm_size: 256m. At 512 pids and 1 GB, four concurrent renders crashed or froze it.WATCHDOG_ENABLED: "true" stops chromedriver when it stops answering or memory thrashes;
restart: unless-stopped then starts a fresh container. The image's health check (/status)
only marks it unhealthy - Docker never restarts an unhealthy container by itself.LANG/LANGUAGE set the browser's locale: date and number formats in form fields follow it.In CI, wait for the container to be healthy before the first render; "Connection refused" on port 3000 right after start means it was not ready yet.
bidi2pdf render --url http://app:3000/report --output report.pdf \
--remote-browser-url http://remote-chrome:3000/session
The page URL must be reachable from the browser container, not from where the command runs:
localhost there is the browser itself. Use the application's service name, and for a Rails app
make the PDF's asset host that same name, or every stylesheet fails and the PDF is blank.
A process that crashes or is killed mid-render leaves its Chrome session open on the shared
chromedriver, and each one holds memory. bidi2pdf records the sessions it opens on this machine
(SessionRegistry); look and clean up with:
bidi2pdf sessions --remote-browser-url http://remote-chrome:3000/session
bidi2pdf sweep --remote-browser-url http://remote-chrome:3000/session --dry-run
bidi2pdf sweep --remote-browser-url http://remote-chrome:3000/session
sweep closes recorded sessions older than --older-than (600 s), unresponsive ones, and the oldest
above --max-sessions; never one younger than --min-age or one a running process holds. Leave
--scope all to a chromedriver your application owns alone - it also closes sessions other
programs opened. Run sweep from cron or a timer, and --dry-run first.
Code that opens its own sessions (a test driver, a script) passes a SessionRegistry to
Bidi2pdf::Bidi::Session.new(..., registry: Bidi2pdf::SessionRegistry.new(url)) and closes the
session in an ensure, with a time limit on the close: a hung close is the most common leak.
Renders run in parallel on one chromedriver, one session (or a tab of one) each. Measure your own
pages: start with 2 GB, run the peak number of renders at once, and watch docker stats for memory
and pids. Raise mem_limit and pids_limit together.
A page from a user is a page that runs its scripts in your browser. Before navigating:
tab.disable_script_execution - the page's JavaScript does not run at all.render_html_content, --html-file) over handing Chrome a URL a
user typed.Before production, test the isolation with hostile pages, not by reading the configuration. Render
pages that try, each on its own: to fetch an internal service and your cloud metadata address, to load
file:///etc/passwd and other file: URLs, to open new windows, to run scripts despite
disable_script_execution, and to exhaust memory. Each must fail or stay contained, and the
chromedriver must keep serving other renders. Repeat it after changing the image, the capabilities or
the seccomp profile.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub dieter-medium/bidi2pdf --plugin bidi2pdf6 skills in this plugin
/diagnose-pdfThis skill should be used when a PDF made with bidi2pdf (CLI, Ruby API or bidi2pdf-rails) is blank, half empty, unstyled, missing images or fonts, cut off, on the wrong number of pages, shows dates in the wrong format, or breaks words badly. A checklist from the cheapest check to the most expensive, using bidi2pdf diagnose./page-screenshotsThis skill should be used when pages of a web site or app need screenshots for a design, UX or accessibility review - at phone and desktop width, in light and dark mode - or when one screenshot shows what Chrome rendered for a PDF. Uses bidi2pdf's browser (local or a shared chromedriver), not Playwright or Puppeteer./pdf-recipeThis skill should be used when a PDF needs more than one render call - waiting for an element, clicking something open, running a script, switching to screen view or a viewport first - or when a PDF must be checked (page count, text in it, no failed requests). Writes and validates a bidi2pdf recipe YAML without a browser, then runs it./pdf-specsThis skill should be used when writing or fixing RSpec specs that render PDFs or drive pages with bidi2pdf - asserting text, page count or images in a generated PDF, starting a Chrome container for the suite, or a browser spec that is flaky, times out or sees an empty page./render-pdfThis skill should be used when a web page, a URL or an HTML file has to become a PDF with bidi2pdf's command line, including a PDF of a page's screen view, dark mode or mobile layout, a tagged (accessible) PDF, or a PDF piped through stdin/stdout. Covers the order of commands, the waits, reading the JSON result and the exit codes.Other plugins' skills for the same job