WEASYPRINT(1)

πŸ’– WEASYPRINT πŸ’–

okay bestie, sit down, hydrate, because today we're talking about WeasyPrint β€” aka The Awesome Document Factory, and yes that is its literal official subtitle, the manpage is not being cute, it just IS that iconic. 🌸

We're living in the WEASYPRINT(1) manual page, general commands, and I'm about to walk you through every single flag like we're ranking them on a tier list. No skipping. We do not skip. Not on my watch. πŸ’…


✨ NAME ✨

weasyprint β€” The Awesome Document Factory 🏭✨

weasyprint.__main__.main(argv=sys.argv)

okay so the weasyprint program is lowkey demanding, it needs at least two arguments fr fr:

weasyprint [options] <input> <output>
  • input β€” the URL or filename of your HTML input. and yes, you can just hit it with - and feed it stdin like a little legend. πŸ’«
  • output β€” the filename where the output gets written. or - for stdout, because sometimes you just want it in your face immediately. 🫢

πŸŽ€ the lil "just give me info" flags

  • -i, --info β€” prints system information and then dips. exit stage left. πŸ‘‹
  • --version β€” prints WeasyPrint's version number and peaces out. the classic "who even am I" move. 🌈

🎨 RENDERING OPTIONS 🎨

this is the main character section, ngl. this is where the magic happens. πŸ”₯

  • -s <stylesheet>, --stylesheet <stylesheet> β€” URL or filename for a user CSS stylesheet. and bestie, you can pass this option multiple times β€” stack them like bracelets. πŸŽ€
  • -a <attachment>, --attachment <attachment> β€” URL or filename of a file to attach to the PDF document. also passable multiple times, collect them all. 🧚
  • --attachment-relationship <attachment-relationship> β€” the relationship of the attachment file to attach to the PDF. yep, also multiple times. the attachment lore runs deep.
  • --pdf-identifier <pdf-identifier> β€” the PDF file identifier. it's giving "everyone needs a little ID". πŸͺͺ
  • --pdf-variant <pdf-variant> β€” which PDF variant to generate. the possible choices are a whole buffet:
    • pdf/a-1b, pdf/a-2b, pdf/a-3b, pdf/a-2u, pdf/a-3u, pdf/a-4u, pdf/a-1a, pdf/a-2a, pdf/a-3a, pdf/a-4e, pdf/a-4f, pdf/ua-1, pdf/ua-2, pdf/x-1a, pdf/x-3, pdf/x-4, pdf/x-5g, debug
    • that's a LOT of choices and honestly? slay for having options.
  • --pdf-version <pdf-version> β€” the PDF version number. just a number, no drama.
  • --pdf-forms β€” includes PDF forms. forms!! interactive!! ✨
  • --pdf-tags β€” tags the PDF for accessibility. accessibility is not a vibe, it's a standard, and we love it here. πŸ‘‘
  • --uncompressed-pdf β€” do not compress the PDF content. it says "mainly for debugging purpose" so like, it's for the detective work, not for shipping. πŸ”
  • --xmp-metadata <xmp-metadata> β€” URL or filename of a file to include into the XMP metadata. and yeah, multiple times is allowed. the metadata stacking goes crazy.
  • --custom-metadata β€” includes custom HTML meta tags in the PDF metadata. your meta, your rules. πŸ¦‹
  • --output-intent <output-intent> β€” Srgb, device-cmyk, or a CSS identifier of the output intent color space. pick your color destiny. 🌈
  • -p, --presentational-hints β€” follow HTML presentational hints. the old-school hints get to speak too. πŸ—£οΈ
  • --optimize-images β€” optimizes the size of embedded images with no quality loss. free glow-up, zero cost. ate. πŸ’…
  • -j <jpeg-quality>, --jpeg-quality <jpeg-quality> β€” JPEG quality between 0 (worst) to 95 (best). note that it tops out at 95, not 100, that's just the deal, don't argue with the numbers. 😭
  • -D <dpi>, --dpi <dpi> β€” sets the maximum resolution of images embedded in the PDF. crisp or crunchy, your call. πŸ“
  • --full-fonts β€” embeds unmodified font files when possible. the whole font. unbothered. unedited. un-chopped. πŸ‘‘
  • --hinting β€” keeps the hinting information in embedded fonts. the little hints stay ✨
  • -c <cache-folder>, --cache-folder <cache-folder> β€” stores the cache on disk instead of memory. the folder is created if needed and cleaned after the PDF is generated. it literally cleans up after itself, main character behavior. 🧹

🌐 HTML OPTIONS 🌐

  • -e <encoding>, --encoding <encoding> β€” force the input character encoding. no guessing games. πŸ”’
  • -m <media-type>, --media-type <media-type> β€” the media type to use for @media. it defaults to print. as it should. πŸ–¨οΈ
  • -u <base-url>, --base-url <base-url> β€” the base for relative URLs in the HTML input. it defaults to the input's own filename or URL, or the current directory for stdin. so it figures it out for you, but you can also just tell it. 🫢

πŸ“‘ URL FETCHER OPTIONS πŸ“‘

  • -t <timeout>, --timeout <timeout> β€” set the timeout in seconds for HTTP requests. don't let the network hold you hostage. ⏰
  • --allowed-protocols <allowed-protocols> β€” only authorizes a comma-separated list of protocols for fetching URLs. allowlist energy. πŸ›‚
  • --no-http-redirects β€” do not follow HTTP redirects. we stay. we do not chase. πŸ’€
  • --fail-on-http-errors β€” abort document rendering on any HTTP error. ruthless. honestly? respect.

πŸ’« The Awesome Document Factory πŸ’«

WeasyPrint is a smart solution helping web developers to create PDF documents. It turns simple HTML pages into gorgeous statistical reports, invoices, tickets… and like, that's genuinely the plot. simple in, gorgeous out. πŸŽ€

From a technical point of view, WeasyPrint is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license. 🌸

It is based on various libraries but not on a full rendering engine like WebKit or Gecko. The CSS layout engine is written in Python, designed for pagination, and meant to be easy to hack on. so yes bestie, you can hack on it, go forth. πŸ”₯

WeasyPrint has been created and developed by Kozea (<https://kozea.fr/>). Professional support, maintenance and community management is provided by CourtBouillon (<https://www.courtbouillon.org/>). πŸ‘‘

Copyrights are retained by their contributors, and no copyright assignment is required to contribute to WeasyPrint. Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion is licensed under the BSD 3-clause license, without any additional terms or conditions. For full authorship information, see the version control history. πŸ•°οΈ


🌟 Author 🌟

Simon Sapin and contributors πŸ’œ

Simon Sapin and contributors πŸ’œ


okay and finally, the lil sign-off, the credits roll: this is WeasyPrint version 69.0, dated Jun 22, 2026, and it lives in the WEASYPRINT(1) manual section. that's the whole page, bestie. go make some gorgeous PDFs. periodt. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from