Documentation Playground
Docs / Inject Css Js
Configuration

CSS & JS Injection

Dynamically inject custom CSS stylesheets or execute JavaScript before the PDF is rendered. This is extremely useful for hiding specific elements on a target URL or modifying the layout for print.

Implementation Example

JSON Payload
{ "url": "https://example.com/invoice", // Hide the navigation bar and footer for the print version "css": "nav, footer { display: none !important; } body { background: white; }", // Execute script to expand all accordions before printing "js": "document.querySelectorAll('details').forEach(d => d.open = true);" }

Parameters Explained

css
A raw CSS string. This is automatically injected into a <style> block at the end of the <head> element, overriding previous styles.
js
A raw JavaScript string. This is executed by the Chromium engine after the page loads but before the PDF is printed. Useful for DOM manipulation or expanding collapsed UI elements.