[Playwright/Container] problem to generate a PDF / button
Hello ! It's been a while ! :) How have you been since then ?
I have a problem to generate PDF using ReadTheDocs CI. (It's a problem I have since multiple month). EDIT: I finally obtained the status "Build Completed" but impossible to generate a PDF IDK why...
I also finally managed to get myself a 3-month subscription to ReadTheDocs CI and have access to the documentation generation tell me if you want have an access to it to do some test, and maybe improve your documentation.
Here's my .readthedocs.yaml file :
---
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.10"
apt_packages:
- libflite1
- gconf-service
- libasound2
- libatk1.0-0
- libcairo2
- libcups2
- libfontconfig1
- libgdk-pixbuf2.0-0
- libgtk-3-0
- libnspr4
- libpango-1.0-0
- libxss1
- fonts-liberation
- libappindicator1
- libnss3
- lsb-release
- xdg-utils
jobs:
pre_build:
- export MKDOCS_EXPORTER_PDF_ENABLED=true
#- echo "deb http://ftp.us.debian.org/debian bookworm main non-free" >> /etc/apt/sources.list.d/fonts.list
- PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=100000 python -m playwright install chromium
mkdocs:
configuration: mkdocs.yml
# Optionally declare the Python requirements required to build your docs
python:
install:
- requirements: requirements.txt
here's my mkdocs.yml file:
---
# Project information
site_name: Documentation
site_url: https://documentation.readthedocs-hosted.com/
site_author: Me
site_description: >-
A documentation for Me
# Repository
#repo_name: group/domain/documentation
#repo_url: https://url/group/documentation
# Theme
theme:
name: material
highlightjs: true
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/toggle-switch-off-outline
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/toggle-switch
name: Switch to light mode
features:
- navigation.tracking
icon:
logo: logo
favicon:
# Plugins
plugins:
- search:
separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;'
- exporter:
formats:
pdf:
explicit: true
enabled: true
concurrency: 8
covers:
front: resources/templates/covers/front.html.j2
#back: resources/templates/covers/back.html.j2
stylesheets:
- resources/stylesheets/pdf.scss
buttons:
- title: Download as PDF
icon: material-file-download-outline
enabled: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.enabled
attributes: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.attributes
# Extensions
markdown_extensions:
- admonition
- toc:
permalink: true
- pymdownx.betterem:
smart_enable: all
- pymdownx.details
- pymdownx.emoji:
emoji_generator: !!python/name:material.extensions.emoji.to_svg
emoji_index: !!python/name:material.extensions.emoji.twemoji
- pymdownx.highlight:
anchor_linenums: true
- pymdownx.keys
- pymdownx.tabbed:
alternate_style: true
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
# Navigator
#nav:
and my requirements.txt :
mkdocs
mkdocs-material
mkdocs-exporter # PDF export
pymdown-extensions
playwright
Do all the pages you want exported have pdf: true in the frontmatter?
The explicit: true option makes all pages excluded for export by default.
Oops my bad, I forgot to remove the explicit: true when I did some test and check if I can have a "build completed" status...
I also removed the explicit: true for the test, and... now it work... I don't get it...
I spend a lot of month to fix the playwright problem and now it work... with just that... well, maybe there is a better optimization than what I did ?