Jetformat

Set up HTML to PDF rendering (beta)

The html resource has one verb, to-pdf. Pass a file, a static directory, or a URL, then wait for the page before capture. It needs a separate renderer service.

By Jetformat

HTML-to-PDF conversion captures a web document as paginated PDF output. Jetformat’s beta html to-pdf command requires a separate HTML renderer service. Unlike Office conversion and ordinary PDF processing, this command does not complete entirely inside the local CLI.

Choose a file, directory, or URL based on where the page’s assets live. Then configure readiness checks so the PDF captures the report content rather than a loading state.

Choose the source input

Input Suitable source Main check
Local HTML file Self-contained report Required content is included
Directory HTML with nearby CSS, images, or fonts Asset paths resolve
HTTPS URL Deployed web report Renderer can access all resources

For a directory or URL:

jetformat html to-pdf ./report-site -o report.pdf
jetformat html to-pdf https://example.com/report -o report.pdf

These are alternative inputs. Use one for your job, and supply -o for URL input.

Configure and run the renderer workflow

  1. Confirm a Jetformat HTML renderer is running at an address reachable from the CLI machine.
  2. Set JETFORMAT_HTML_SERVER or pass --server HOST:PORT explicitly.
  3. Prepare the page and its assets, including a readiness selector for dynamic reports.
  4. Run conversion with an explicit PDF output path.
  5. Inspect the PDF page count and review missing images, blank charts, and page breaks.
export JETFORMAT_HTML_SERVER=127.0.0.1:8080
jetformat html to-pdf report.html -o report.pdf --page-size A4 --landscape
jetformat pdf info report.pdf

The address above is a local example; it does not start or install a renderer. If the service runs remotely, the HTML input and renderer’s requests cross that network boundary.

Wait for content before capture

jetformat html to-pdf dashboard.html -o dashboard.pdf   --wait-ready ".dashboard-ready"   --wait-visible "svg.chart"   --wait 2s --timeout 30s

Here, 2 seconds is an additional fixed delay and 30 seconds is an example timeout. Neither is a measured completion time or service guarantee. A readiness marker should appear after the data needed by the report is available. An always-present wrapper is a poor marker because it may exist while the report is still loading.

Diagnose failures and page layout

If the connection fails, check the endpoint and reachability before changing the HTML. If a readiness check times out, inspect whether the selected element ever appears from the renderer’s environment. If the PDF is created but looks wrong, review fonts, asset paths, and print-specific CSS separately.

MDN’s printing guide covers CSS for printed output. A screen layout and a printed layout can differ; test the generated PDF rather than assuming a browser screenshot predicts pagination.

Understand credits and limits

Conversion uses 1 credit per output page. An illustrative 6-page report uses 6 credits; rendering 2 preview pages afterwards brings the total to 8 credits. Failed conversions are not charged. The command does not perform OCR, generate Office XML, or convert PDF back into HTML.

See the HTML CLI reference, readiness checklist, and file-processing boundaries.

Last updated