zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
313 stars 44 forks source link

mkdocs build with -pdf-export throws errors #26

Closed echasin closed 5 years ago

echasin commented 5 years ago

Tested on both macOs and windows. Any thought on how to fix? Thx in advance 1) Python 3.7.1 2) site_name: My Docs theme: name: 'material' plugins:

3) Errror:LMHQUCIS245764:system-modernization-BOK erchasin$ mkdocs build Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/mkdocs", line 11, in sys.exit(cli()) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 764, in call return self.main(args, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, ctx.params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/click/core.py", line 555, in invoke return callback(args, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/main.py", line 163, in build_command ), dirty=not clean) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/commands/build.py", line 240, in build config = config['plugins'].run_event('config', config) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs/plugins.py", line 94, in run_event result = method(item, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/plugin.py", line 43, in on_config from .renderer import Renderer File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mkdocs_pdf_export_plugin/renderer.py", line 4, in from weasyprint import HTML, Document File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/init.py", line 393, in from .css import preprocess_stylesheet # noqa File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/css/init.py", line 25, in from . import computed_values File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/css/computed_values.py", line 17, in from .. import text File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/weasyprint/text.py", line 14, in import cairocffi as cairo File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairocffi/init.py", line 41, in cairo = dlopen(ffi, 'cairo', 'cairo-2', 'cairo-gobject-2') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cairocffi/init.py", line 38, in dlopen raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names)) OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 LMHQUCIS245764:system-modernization-BOK erchasin$

shauser commented 5 years ago

Please make sure you followed the README for the requirements: https://github.com/shauser/mkdocs-pdf-export-plugin#requirements

If you did, please test whether calling weasyprint directly works correctly.

echasin commented 5 years ago

Thanks for the quick response. i will try tomorrow

Sent from my iPhone

On Dec 3, 2018, at 10:29 PM, Stephan Hauser notifications@github.com<mailto:notifications@github.com> wrote:

Please make sure you followed the README for the requirements: https://github.com/shauser/mkdocs-pdf-export-plugin#requirements

If you did, please test whether calling weasyprint directly works correctly.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/shauser/mkdocs-pdf-export-plugin/issues/26#issuecomment-443986969, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACeApml5-pCiaHBKZbBtKxjmyMCnHKrbks5u1hZPgaJpZM4Y_uDp.

echasin commented 5 years ago

Making progress but still get some errors . Went thru all the steps weasyprint. I am getting some weasyprint errors. Mkdocs is generating pds but when I add pdf-export option I get cant load font errors.

The error is occures 15 times ERROR: Failed to load font at "file:///D:/github-system-modernization/BOK/site/assets/fonts/specimen/MaterialIcons-Regular.woff2" Converting 15 files to PDF took 21.5s

plugins:

waesyprintwarnings.txt

zhaoterryy commented 5 years ago

30

zhaoterryy commented 5 years ago

I just realized you're using woff2 fonts. These aren't supported by Weasyprint.

https://weasyprint.readthedocs.io/en/stable/features.html#fonts