Guide

Charts in PDF reports: one HTTPS GET per chart

Invoices, monthly statements and data exports are written by a report generator, not by a browser. A UrlChart URL turns the chart into a single PNG fetched over HTTPS, which the generator embeds at a physical size it controls. No browser, no canvas and no font set in the report build.

Why a chart library is awkward here

A JavaScript chart library needs a document to draw into. At PDF generation time there is no DOM and no canvas, so a pipeline that insists on a library-rendered chart has two options and pays for both in the build image.

Neither route makes export fidelity easy. Text drawn through the PDF layer is subject to font substitution: a face that exists on the build machine and not in the reader is re-mapped and the metrics shift. Layout reflow moves a figure when the page breaks inside it, and a wide chart either shrinks below legibility or overflows the page. A vector chart survives zooming but not substitution; a raster chart survives substitution but not zooming. Deciding which failure is acceptable per document is work that has nothing to do with the numbers in the report.

What the image URL removes from the pipeline

A real render

Bar chart of monthly revenue in 2026: Jan 42, Feb 55, Mar 48, Apr 71, May 63, Jun 80, Jul 58, Aug 66, Sep 74, Oct 69, Nov 85, Dec 92.
This is a real UrlChart render, not a screenshot: the image above was fetched from the URL below as this page loaded. The same bytes are what a report generator embeds.

The URL is the entire chart. Keep it as a constant in the report code, or build it from the period being reported:

https://urlchart.com/chart?cht=bvs&chs=720x360&chd=t:42,55,48,71,63,80,58,66,74,69,85,92&chxl=0:|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec&chxt=x,y&chco=2f5fe0&chtt=Monthly+revenue+2026

Size the chart in pixels, not in percent

chs is the render size in pixels, fixed at render time: a PNG has no notion of a page. Do the arithmetic once, in the report code, and keep the number beside it.

Resolution is baked into the PNG

The render is the resolution. To print crisply, ask for a larger canvas and let the engine scale it down to the physical width: for that 190 mm column, a 1440 px render is about 192 dpi where a 720 px render is about 96 dpi.

Know what the free tier actually serves. Anonymous requests are capped at 1000 px per side and 1,000,000 total pixels, so a chs=1440x720 request is served as 1000x500 and the reduction is reported in the X-UrlChart-Meta response header instead of silently pretending the canvas matched. A paid key raises the cap to 3000 px per side and 9 MP, which covers a 2x column. There is no separate DPI parameter: resolution is the pixel count divided by the physical width you choose.

Never stretch a small render up. A 400 px chart placed across 170 mm is about 60 dpi of ink: the viewer and the printer scale pixels, so the labels blur rather than gain detail.

Legibility at print size

Font size and tick density are part of the render, not of the PDF, so they are decided when you pick chs:

Caching, and how to change a chart

Embedding it in the flows you already have