You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Receiving the following error when generating PDF:
INFO - Rendering for PDF.
INFO - Output a PDF to "my.pdf".
...
Traceback (most recent call last):
File "/env/lib64/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
build.build(cfg, dirty=not clean)
File "/env/lib64/python3.11/site-packages/mkdocs/commands/build.py", line 332, in build
config.plugins.run_event('post_build', config=config)
File "/env/lib64/python3.11/site-packages/mkdocs/plugins.py", line 522, in run_event
result = method(**kwargs)
^^^^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/mkdocs_with_pdf/plugin.py", line 135, in on_post_build
self.generator.on_post_build(config, self.config['output_path'])
File "/env/lib64/python3.11/site-packages/mkdocs_with_pdf/generator.py", line 157, in on_post_build
render.write_pdf(abs_pdf_path)
File "/env/lib64/python3.11/site-packages/weasyprint/document.py", line 399, in write_pdf
pdf = generate_pdf(self, target, zoom, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/weasyprint/pdf/__init__.py", line 261, in generate_pdf
pdf_fonts = build_fonts_dictionary(
^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/weasyprint/pdf/fonts.py", line 47, in build_fonts_dictionary
for letter, key in font.ttfont.getBestCmap().items():
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'getBestCmap'
Same run using weasyprint 58.1
INFO - Rendering for PDF.
INFO - Output a PDF to "my.pdf".
Traceback (most recent call last):
...
File "/env/lib64/python3.11/site-packages/mkdocs/__main__.py", line 250, in build_command
build.build(cfg, dirty=not clean)
File "/env/lib64/python3.11/site-packages/mkdocs/commands/build.py", line 332, in build
config.plugins.run_event('post_build', config=config)
File "/env/lib64/python3.11/site-packages/mkdocs/plugins.py", line 522, in run_event
result = method(**kwargs)
^^^^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/mkdocs_with_pdf/plugin.py", line 135, in on_post_build
self.generator.on_post_build(config, self.config['output_path'])
File "/env/lib64/python3.11/site-packages/mkdocs_with_pdf/generator.py", line 157, in on_post_build
render.write_pdf(abs_pdf_path)
File "/env/lib64/python3.11/site-packages/weasyprint/document.py", line 360, in write_pdf
pdf = generate_pdf(
^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/weasyprint/pdf/__init__.py", line 256, in generate_pdf
pdf_fonts = build_fonts_dictionary(pdf, document.fonts, optimize_size)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib64/python3.11/site-packages/weasyprint/pdf/fonts.py", line 50, in build_fonts_dictionary
ratio = 1024 / font.ttfont['head'].unitsPerEm
~~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
If you revert your weasyprint to latest 57 (57.2) then the generation works.
Here in case others want a quick fix.
The text was updated successfully, but these errors were encountered:
Python 3.11
requirements.txt and installed versions
Receiving the following error when generating PDF:
Same run using weasyprint 58.1
If you revert your weasyprint to latest 57 (57.2) then the generation works.
Here in case others want a quick fix.
The text was updated successfully, but these errors were encountered: