zhaoterryy / mkdocs-pdf-export-plugin

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

Font spacing issue #106

Open tomjones1977 opened 2 years ago

tomjones1977 commented 2 years ago

When using the pdf export tool within a CI pipeline, the PDF has odd spacing issues with the output. The alpine base container has had the fonts installed as part of the build using the following:

RUN apk add fontconfig ttf-roboto ttf-roboto-mono ttf-font-awesome ttf-freefont font-noto terminus-font \
    && fc-cache -f \
    && fc-list | sort

However the PDF is output with odd spacing in the fonts, as per the screenshot below:

image

Nothing I change seems to fix this - any idea what could be causing it?

SamueleSoraggi commented 2 years ago

Same problem here, still not found a solution

glenux commented 2 years ago

Same problem here.

The configuration i use for the plugin :

plugins:
  - pdf-export:
      verbose: true
      media_type: print
      enabled_if_env: ENABLE_PDF_EXPORT
      combined: true

The Pipfile

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
mkdocs = "*"
mkdocs-material = "*"
mdx-truly-sane-lists = "*"
pymdown-extensions = "*"
honcho = "*"
pyinotify = "*"
mkdocs-pdf-export-plugin = "*"

[requires]
python_version = "3.8"

Output of pipenv graph

Brotli==1.0.9
honcho==1.0.1
mdx-truly-sane-lists==1.2
  - Markdown [required: >=2.6, installed: 3.3.4]
mkdocs-material==7.3.3
  - jinja2 [required: >=2.11.1, installed: 3.0.2]
    - MarkupSafe [required: >=2.0, installed: 2.0.1]
  - markdown [required: >=3.2, installed: 3.3.4]
  - mkdocs [required: >=1.2.2, installed: 1.2.3]
    - click [required: >=3.3, installed: 8.0.3]
    - ghp-import [required: >=1.0, installed: 2.0.2]
      - python-dateutil [required: >=2.8.1, installed: 2.8.2]
        - six [required: >=1.5, installed: 1.16.0]
    - importlib-metadata [required: >=3.10, installed: 4.8.1]
      - zipp [required: >=0.5, installed: 3.6.0]
    - Jinja2 [required: >=2.10.1, installed: 3.0.2]
      - MarkupSafe [required: >=2.0, installed: 2.0.1]
    - Markdown [required: >=3.2.1, installed: 3.3.4]
    - mergedeep [required: >=1.3.4, installed: 1.3.4]
    - packaging [required: >=20.5, installed: 21.0]
      - pyparsing [required: >=2.0.2, installed: 2.4.7]
    - PyYAML [required: >=3.10, installed: 6.0]
    - pyyaml-env-tag [required: >=0.1, installed: 0.1]
      - pyyaml [required: Any, installed: 6.0]
    - watchdog [required: >=2.0, installed: 2.1.6]
  - mkdocs-material-extensions [required: >=1.0, installed: 1.0.3]
  - pygments [required: >=2.4, installed: 2.10.0]
  - pymdown-extensions [required: >=9.0, installed: 9.0]
    - Markdown [required: >=3.2, installed: 3.3.4]
mkdocs-pdf-export-plugin==0.5.10
  - beautifulsoup4 [required: >=4.6.3, installed: 4.10.0]
    - soupsieve [required: >1.2, installed: 2.2.1]
  - mkdocs [required: >=0.17, installed: 1.2.3]
    - click [required: >=3.3, installed: 8.0.3]
    - ghp-import [required: >=1.0, installed: 2.0.2]
      - python-dateutil [required: >=2.8.1, installed: 2.8.2]
        - six [required: >=1.5, installed: 1.16.0]
    - importlib-metadata [required: >=3.10, installed: 4.8.1]
      - zipp [required: >=0.5, installed: 3.6.0]
    - Jinja2 [required: >=2.10.1, installed: 3.0.2]
      - MarkupSafe [required: >=2.0, installed: 2.0.1]
    - Markdown [required: >=3.2.1, installed: 3.3.4]
    - mergedeep [required: >=1.3.4, installed: 1.3.4]
    - packaging [required: >=20.5, installed: 21.0]
      - pyparsing [required: >=2.0.2, installed: 2.4.7]
    - PyYAML [required: >=3.10, installed: 6.0]
    - pyyaml-env-tag [required: >=0.1, installed: 0.1]
      - pyyaml [required: Any, installed: 6.0]
    - watchdog [required: >=2.0, installed: 2.1.6]
  - weasyprint [required: >=0.44, installed: 53.3]
    - cffi [required: >=0.6, installed: 1.15.0]
      - pycparser [required: Any, installed: 2.20]
    - cssselect2 [required: >=0.1, installed: 0.4.1]
      - tinycss2 [required: Any, installed: 1.1.0]
        - webencodings [required: >=0.4, installed: 0.5.1]
      - webencodings [required: Any, installed: 0.5.1]
    - fonttools [required: >=4.0.0, installed: 4.27.1]
    - html5lib [required: >=1.0.1, installed: 1.1]
      - six [required: >=1.9, installed: 1.16.0]
      - webencodings [required: Any, installed: 0.5.1]
    - Pillow [required: >=4.0.0, installed: 8.3.2]
    - pydyf [required: >=0.0.3, installed: 0.1.1]
    - Pyphen [required: >=0.9.1, installed: 0.11.0]
    - tinycss2 [required: >=1.0.0, installed: 1.1.0]
      - webencodings [required: >=0.4, installed: 0.5.1]
pyinotify==0.9.6
zopfli==0.1.8
chrisesharp commented 2 years ago

This is still a problem for me, too...has anyone managed to find a workaround?

wabamonsta commented 2 years ago

Im having the same issue

rvanbekkum commented 2 years ago

Running into the same issue, after installing everything on a new self-hosted build server (Windows Server 2022).

rvanbekkum commented 2 years ago

I have reverted the versions of the installed packages back to the following:

beautifulsoup4==4.8.1
cairocffi==1.1.0
CairoSVG==2.4.2
cffi==1.13.0
Click==7.0
cssselect2==0.2.2
defusedxml==0.6.0
future==0.18.2
html5lib==1.0.1
htmlmin==0.1.12
importlib-metadata==3.7.3
Jinja2==2.10.3
joblib==1.0.1
jsmin==2.2.2
livereload==2.6.1
lunr==0.5.8
Markdown==3.3.4
MarkupSafe==1.1.1
mkdocs==1.1.2
mkdocs-material==7.0.6
mkdocs-material-extensions==1.0.1
mkdocs-minify-plugin==0.2.1
mkdocs-pdf-export-plugin==0.5.8
nltk==3.5
pep562==1.0
Pillow==6.2.0
pycparser==2.19
Pygments==2.8.1
pymdown-extensions==8.1.1
Pyphen==0.9.5
PyYAML==5.1.2
regex==2021.3.17
six==1.12.0
soupsieve==1.9.4
tinycss2==1.0.2
tornado==6.0.3
tqdm==4.59.0
typing-extensions==3.7.4.3
WeasyPrint==50
webencodings==0.5.1
zipp==3.4.1

And have installed gtk3-runtime-3.24.11-2019-10-04. After that restarted the server. (N.B. This was the configuration running on our old build server)

Now everything works fine again. Was not able yet to determine which package is causing the problems, but I think it might be the latest version(s) of WeasyPrint or the latest GTK3 runtime.

ov3rk1ll commented 1 year ago

I ran into the same problem and came across this issue.

For it was enough to just update WeasyPrint (WeasyPrint==50 in my requirements.txt) to fix this problem on my (GitLab) build server