Skip to content

Chromedp PDF in Production and What a Year of Running a Go Render Pool Costs

chromedp prints a PDF in fifteen lines and matches Chrome exactly. One container clears 4,800 an hour, so a 50,000 document month-end run takes 10 hours. Here is the full year of cost against an API plan.

Live demo

Runs in your browser. Nothing is uploaded. One PDF free to try, then a plan.

Your PDF is downloading. That was the free one. The Starter plan converts as many as you need, for $49 a month or $288 a year, half price.

See the plan

chromedp makes a PDF from Go in about fifteen lines, and the output is identical to Chrome's print preview. That is why it is the default answer, and also why teams ship it without working out what it costs to keep running. The numbers that matter to a buyer are how many documents per hour one service prints, what the month-end run looks like, and how many engineering hours sit behind the first version. This article works one example through with every assumption labelled, so you can swap in your own.

The short answer

chromedp is the right tool for a Go service that renders a few thousand PDFs a month and has an engineer who is happy to own Chromium. At 50,000 documents a month, arriving in batches, the compute is still cheap but the people time is not. In the example below, a year of self-hosting costs about ten times the yearly price of a 50,000 render API plan, and nearly all of it is labor rather than servers.

How do you generate a PDF with chromedp?

chromedp starts Chromium, loads your page and calls the DevTools Page.printToPDF command, documented in the Chrome DevTools Protocol reference. To print an HTML string you load a blank page, set the document content, then print.

ctx, cancel := chromedp.NewContext(allocCtx)
defer cancel()
ctx, cancel = context.WithTimeout(ctx, 30*time.Second)
defer cancel()

var pdf []byte
err := chromedp.Run(ctx,
    chromedp.Navigate("about:blank"),
    chromedp.ActionFunc(func(ctx context.Context) error {
        tree, err := page.GetFrameTree().Do(ctx)
        if err != nil {
            return err
        }
        if err := page.SetDocumentContent(tree.Frame.ID, html).Do(ctx); err != nil {
            return err
        }
        pdf, _, err = page.PrintToPDF().WithPrintBackground(true).Do(ctx)
        return err
    }),
)

That is the prototype, and it is the reason the cost question gets skipped. Everything below is what the snippet leaves out. If you are still choosing between chromedp, Rod and the older wrappers, start with the HTML to PDF Golang comparison.

What does one chromedp service actually handle?

Take a realistic job. Each render takes 3 seconds, covering template output, a web font, a chart script and the print itself. You run one long lived browser and cap it at 4 concurrent tabs, which on an assumed 2 GB container leaves room for roughly 400 MB per tab. These are planning assumptions, not benchmarks, so measure a representative template before you size anything.

SetupConcurrent rendersThroughputTime to clear 50,000 documents
One container, 4 tabs41.33 per second, 4,800 per hour10.4 hours
Three containers behind a queue124 per second, 14,400 per hour3.5 hours
SitePDF Growth tier103.3 per second, 12,000 per hour4.2 hours

The arithmetic is concurrency divided by render time, then 50,000 divided by the hourly rate. Average load is no problem: 50,000 a month over 22 working days is about 2,270 a day. The pain is the batch. Statements, invoices and compliance exports fire at once at month end, and a 10 hour backlog on one container means customers get their documents the next morning. Closing that gap means more containers, a queue, retries and autoscaling, which is a project rather than a setting.

What breaks in production and who fixes it?

Go services tend to be small and boring, and a browser is neither. These are the failure modes teams meet in the first months.

  • Hung pages. A script that never settles holds a tab forever. Every render needs a context timeout, and a timed out tab must be closed or it leaks memory.
  • Memory growth. A long lived browser accumulates state. Most teams recycle it after a fixed number of renders and keep two browsers so one can drain while the other serves.
  • Image size. Chromium means a base image with shared libraries and fonts, so the tidy scratch image you chose Go for is gone, and missing fonts show up as boxes in customer invoices.
  • Chromium updates. Security fixes ship often. Someone owns the rebuild, the test of the layout against the new version and the rollout.
  • Silent layout drift. A new Chromium can move a page break. If the PDF is a legal document, nobody notices until a customer does.

None of this is exotic. It is simply work that nobody scheduled when the fifteen line prototype passed review.

What does it cost to run chromedp for PDFs in production?

Compute is the small line. Three containers at an assumed $40 a month each is $1,440 a year. The large line is engineering time, so here are the assumptions, all labelled: 20 hours to build the pool, timeouts, recycling, queue and alerts; 2 hours a month for Chromium updates and incidents; and $100 an hour as the loaded cost of an engineer.

ItemBasisYear one
Build and harden20 hours at $100$2,000
Maintenance24 hours at $100$2,400
Containers3 at $40 a month$1,440
Self-hosted total$5,840
SitePDF Growth, 50,000 renders a month$99 list, about $49 a month on yearly billing$588

On those assumptions self-hosting costs roughly ten times the Growth plan for one year. Cut the labor in half and it is still about six times. The balance tips toward chromedp only when volume is so low that the API plan would sit mostly unused, or when you already run a browser fleet and the marginal cost is close to zero. The wider build versus buy comparison, with other libraries, is on HTML to PDF library vs API, and the same sums for Node are in the Playwright production cost article.

When chromedp is still the right choice

Keep chromedp when documents must never leave your network, when volume is a few hundred a month, or when you have a platform team that already operates headless browsers. Go is common in finance and trading tooling, for example in back office systems that produce end of day reports for people who track gappers and momentum with a real-time scanner for active traders, and some of those teams have exactly the data residency rules that favor running the renderer in house. Choose it on purpose, with the table above in hand.

When to switch to an API

Switch when documents arrive in bursts, when a failed render costs you a customer, or when the hours above are hours you want back. The call from Go is one net/http request, shown on the Golang page, and SitePDF adds a dated archive of every render, which matters when invoices and statements are evidence. Parameters are on the PDF generator API page and the plan ladder is on PDF API pricing.

Rust teams weighing the same trade can read the headless Chrome versus API cost in Rust.

Frequently asked questions

Is chromedp good for generating PDFs?

Yes. It calls Chromium's own print to PDF, so output matches Chrome's print preview, including modern CSS and JavaScript content. The weakness is operational: you own the browser, its memory, its updates and the worker pool around it.

How do I set a timeout on a chromedp PDF render?

Wrap the chromedp context in context.WithTimeout before calling chromedp.Run, and cancel it afterwards so the tab closes. Thirty seconds is a common ceiling for document pages. Without a timeout, one hung script can hold a tab and its memory indefinitely.

How many PDFs per hour can one chromedp service generate?

Divide concurrent tabs by seconds per render, then multiply by 3,600. Four tabs at 3 seconds each give 4,800 an hour. Real figures depend on page weight and container memory, so time a representative template before committing to a number.

Written by the team behind SitePDF, an HTML to PDF API that archives every page it renders. The in-browser converter is free to try, and API plans start at $49 a month, half price billed yearly.

Get started

Render and archive with one API call

A pixel perfect PDF and a dated copy of the page from the same request. Plans from $49 a month, half price billed yearly.

HTML to PDF, in your browser

Buy the plan