Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Playwright/Container] problem to generate a PDF / button #69

Open
boddedo opened this issue Feb 3, 2025 · 1 comment
Open

[Playwright/Container] problem to generate a PDF / button #69

boddedo opened this issue Feb 3, 2025 · 1 comment

Comments

@boddedo
Copy link

boddedo commented Feb 3, 2025

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...

Image

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
@nbanyan
Copy link

nbanyan commented Feb 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants