Skip to content

Proposal: Enable PDF engine switching #48

Open
@hkato

Description

@hkato

Configuration option

plugins:
  - to-pdf:
      engine: [weasyprint|chromium|pandoc|etc|   # default weasyprint

Background

When I try to check mkdocs-material sample.

Update samples/mkdocs-material/mkdocs-material/mkdocs.yml.

plugins:
  - to-pdf:
      debug_html: true

Create an HTML debug output.

$ cd samples/mkdocs-material/mkdocs-material
$ mkdocs build > debug.html

Then convert this HTML to PDF with Google Chrome(macOS)

$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
    --headless \
    --no-pdf-header-footer \
    --print-to-pdf=debug.pdf \
    debug.html 

The PDF output seems almost acceptable to me.

#34

Generated PDF is 14 pages but should be several hundred.

The PDF was 449 pages.

Implementation

Sequence

  1. Generate an HTML file in the tmp directory
  2. Convert the HTML to PDF using Chrome/Chromium

Class

  • Create an abstract base class for the PDF engine
  • Implement the current WeasyPrint PDF engine
  • Then implement a Chromium PDF engine

May I try this? (if I have a free time...)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions