### Install WeasyPrint Dependencies for Wheels (Fedora)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary packages on Fedora to enable WeasyPrint installation using wheels within a virtual environment.
```bash
dnf install python-pip pango
```
--------------------------------
### Clone Repository and Install Dependencies
Source: https://doc.courtbouillon.org/weasyprint/stable/contribute.html
Clone the WeasyPrint repository, create a virtual environment, and install development and documentation dependencies.
```bash
git clone https://github.com/Kozea/WeasyPrint.git
cd WeasyPrint
python -m venv venv
venv/bin/pip install -e '.[doc,test]'
```
--------------------------------
### Install WeasyPrint using Pacman (Archlinux)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install WeasyPrint directly using the pacman command on Archlinux distributions.
```bash
pacman -S python-weasyprint
```
--------------------------------
### Install WeasyPrint using Apt (Debian/Ubuntu)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install WeasyPrint directly using the apt command on Debian (11+) or Ubuntu (20.04+) distributions.
```bash
apt install weasyprint
```
--------------------------------
### Install WeasyPrint on Windows using pip
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Installs WeasyPrint in a virtual environment on Windows using pip after setting up Python and Pango dependencies.
```bash
python -m venv venv
virtualenv\Scripts\activate.bat
python -m pip install weasyprint
python -m weasyprint --info
```
--------------------------------
### Install WeasyPrint in a Virtual Environment (Linux)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Create a virtual environment, activate it, and install WeasyPrint using pip. This is the recommended method for most Linux systems.
```bash
python3 -m venv venv
source venv/bin/activate
pip install weasyprint
weasyprint --info
```
--------------------------------
### Install WeasyPrint using Homebrew (macOS)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install WeasyPrint on macOS using the Homebrew package manager.
```bash
brew install weasyprint
```
--------------------------------
### Install WeasyPrint Dependencies for Wheels (Debian/Ubuntu)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary packages on Debian/Ubuntu to enable WeasyPrint installation using wheels within a virtual environment.
```bash
apt install python3-pip libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0
```
--------------------------------
### Install WeasyPrint Dependencies for Wheels (Archlinux)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary packages on Archlinux to enable WeasyPrint installation using wheels within a virtual environment.
```bash
pacman -S python-pip pango
```
--------------------------------
### Install WeasyPrint on macOS using pip
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Installs WeasyPrint in a virtual environment on macOS using pip after installing dependencies.
```bash
python3 -m venv venv
source venv/bin/activate
pip install weasyprint
weasyprint --info
```
--------------------------------
### Convert URL to PDF using WeasyPrint Python API
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Generates a PDF file from a given URL using the WeasyPrint Python library's quickstart example.
```python
from weasyprint import HTML
HTML('https://weasyprint.org/').write_pdf('/tmp/weasyprint-website.pdf')
```
--------------------------------
### Install WeasyPrint Dependencies for Wheels (Alpine)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary packages on Alpine Linux to enable WeasyPrint installation using wheels within a virtual environment.
```bash
apk add py3-pip so:libgobject-2.0.so.0 so:libpango-1.0.so.0 so:libharfbuzz.so.0 so:libharfbuzz-subset.so.0 so:libfontconfig.so.1 so:libpangoft2-1.0.so.0
```
--------------------------------
### Install WeasyPrint using DNF (Fedora)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install WeasyPrint directly using the dnf command on Fedora distributions (version 39 and later).
```bash
dnf install weasyprint
```
--------------------------------
### Run WeasyPrint from Command Line
Source: https://doc.courtbouillon.org/weasyprint/stable/contribute.html
Execute WeasyPrint to convert an HTML file to PDF using the installed package.
```bash
venv/bin/python -m weasyprint example.html example.pdf
```
--------------------------------
### Install WeasyPrint Dependencies without Wheels (Archlinux)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary development packages on Archlinux for compiling WeasyPrint from source within a virtual environment.
```bash
pacman -S python-pip pango gcc libjpeg-turbo openjpeg2
```
--------------------------------
### Install WeasyPrint Dependencies without Wheels (Debian/Ubuntu)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary development packages on Debian/Ubuntu for compiling WeasyPrint from source within a virtual environment.
```bash
apt install python3-pip libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 libjpeg-dev libopenjp2-7-dev libffi-dev
```
--------------------------------
### Install WeasyPrint Dependencies without Wheels (Fedora)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary development packages on Fedora for compiling WeasyPrint from source within a virtual environment.
```bash
dnf install python3-pip pango gcc python3-devel gcc-c++ zlib-devel libjpeg-devel openjpeg2-devel libffi-devel
```
--------------------------------
### Install WeasyPrint dependencies on macOS using Macports
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Installs pip and Pango dependencies for WeasyPrint on macOS using Macports.
```bash
sudo port install py-pip pango libffi
```
--------------------------------
### Verify Python and Pango Versions
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Check if Python and Pango are installed and meet the minimum version requirements. This is a prerequisite for installing WeasyPrint.
```bash
python3 --version
pango-view --version
```
--------------------------------
### Install WeasyPrint Dependencies without Wheels (Alpine)
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install necessary development packages on Alpine Linux for compiling WeasyPrint from source within a virtual environment.
```bash
apk add py3-pip so:libgobject-2.0.so.0 so:libpango-1.0.so.0 so:libharfbuzz.so.0 so:libharfbuzz-subset.so.0 so:libfontconfig.so.1 so:libpangoft2-1.0.so.0
apk add gcc musl-dev python3-dev zlib-dev jpeg-dev openjpeg-dev libwebp-dev g++ libffi-dev
```
--------------------------------
### Launch Python Interpreter
Source: https://doc.courtbouillon.org/weasyprint/stable/contribute.html
Start a Python interactive session within the virtual environment for testing changes.
```bash
venv/bin/python
```
--------------------------------
### Install WeasyPrint using Alpine Package Manager
Source: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html
Install WeasyPrint directly using the apk command on Alpine Linux distributions (version 3.17 and later).
```bash
apk add weasyprint
```
--------------------------------
### Build Documentation with Sphinx
Source: https://doc.courtbouillon.org/weasyprint/stable/contribute.html
Build the project documentation using Sphinx. The output will be in the docs/_build directory.
```bash
venv/bin/sphinx-build docs docs/_build
```
--------------------------------
### Factur-X/ZUGFeRD XML Structure Example
Source: https://doc.courtbouillon.org/weasyprint/stable/common_use_cases.html
This is an example of the XML structure for a Factur-X/ZUGFeRD invoice. It defines seller, buyer, and settlement details.
```xml
urn:cen.eu:en16931:2017#compliant:basicurn:factur-x.eu:1.0:basic456Seller Corp12345Seller CityFRFR11123456782Buyer Corp987654324456EUR100.0020.00120.00120.00
```
--------------------------------
### WeasyPrint Presentational Hints
Source: https://doc.courtbouillon.org/weasyprint/stable/api_reference.html
Option to follow HTML presentational hints during rendering.
```bash
weasyprint -p