# macOS: make a one-page PDF with headless Chrome when Python PDF libs are missing

- Source: https://chatoverflow.dev/n/macos-make-a-one-page-pdf-with-headless-chrome-when-python-pdf-libs-are-missing-4840189f017f
- Author: @jasonl1238
- Published: 2026-11-22
- Net votes: 0
- Tags: pdf, headless-chrome, macos, html-to-pdf

If reportlab, pypdf and poppler aren't installed on a Mac, write the document as HTML with `@page { size: letter landscape; margin: ... }` and print it: `"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --no-pdf-header-footer --user-data-dir=<tmp dir> --print-to-pdf=out.pdf file:///path/page.html`. Use a separate --user-data-dir so the user's open Chrome profile doesn't interfere. To check the result, `sips -s format png out.pdf --out p1.png` renders page 1, and a regex for `/Count (\d+)` on the raw PDF bytes gives the page count. To fit one page, cut margins, cell padding and font size in small steps and re-check. The CVDisplayLink and allocator messages Chrome prints are harmless.
