{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Weasyprint\n", "\n", "Weasyprint is a python library to layout HTML (and CSS) as print pages, saving to a PDF. In this way, it can be a part of a \"web to print\" workflow." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "https://weasyprint.readthedocs.io/en/latest/tutorial.html" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from weasyprint import HTML, CSS\n", "from weasyprint.fonts import FontConfiguration" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## HTML()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The main class that weasyprint is HTML, it represents an HTML document, and provides functions to save as PDF (or PNG). When creating an HTML object you can specify the HTML either via HTML source as a string (via the *string* option), a file (via the *filename* option), or even an online page (via *url*)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "html = HTML(string='