Open junlicn opened 6 years ago
@junlicn Thanks for reporting. Issue confirmed and marked to be fixed for next release.
Updating the title of this so mulitple issues of the same cause can be merged down into this one.
So I've had deeper dive into this. Unfortunately supporting all languages looks like it's going to be tricky and I don't really want to include many MB's of font files in the code.
As mentioned within #730 and #746, Using the WKHTML instead of the default DOMPDF to render PDF's will allow much easier support of fonts in addition to better rendering overall. Details of changing to WKHTML can be found in the docs here.
I have made a small tweak in b42b07179fb95b0ffdc370a0e8fa1136b97be364 which should increase default support but I know it doesn't cover Japanese/Chinese characters.
Does not work. i have installed wkhtmltopdf and added it via .env file / correct path and all I get is this:
Also, this bug applies to extended set of ASCII - e.g. Central European characters such as ľščťžýáíéúô etc.
Based on this, it is just an issue of a selected font: https://stackoverflow.com/questions/16384517/dompdf-character-encoding-utf-8
Basically, this fixes the bug for extended ASCII - European characters:
setting all fonts in
/vendor/dompdf/dompdf/lib/fonts/dompdf_font_family_cache.dist.php
to:
DejaVuSans
DejaVuSans-Bold
etc.
@nekromoff Yeah, WKHTML can be tricky to set up correctly.
In the latest update, Released yesterday, There have been some updates made to DOMPDF exports to increase support but there's a limit to how much we can support without including a large amounts of fonts.
I think this should be the font setting problem, such as the default ubuntu font "DejaVuSans", which is not Chinese.
For those who've ended up here to find how to resolve non-English characters missing problem on exported PDF file, try these steps. (I was able to have my Korean page properly exported using wkhtmltopdf.)
<link href='https://fonts.googleapis.com/css?family=IBM+Plex+Sans+KR' rel='stylesheet' type='text/css'>
<style>
body, button, input, select, label, textarea {
font-family: 'IBM Plex Sans', sans-serif;
}
</style>
fc-list
and check if the font is on the list.To save your time, I recommend using Google Web Fonts Helper to download font files.
For those who've ended up here to find how to resolve non-English characters missing problem on exported PDF file, try these steps. (I was able to have my Korean page properly exported using wkhtmltopdf.)
- Make sure Bookstack uses fonts that supports your language by changing Custom HTML Head Content settings.
- For example, I used IBM Plex Sans KR.
<link href='https://fonts.googleapis.com/css?family=IBM+Plex+Sans+KR' rel='stylesheet' type='text/css'> <style> body, button, input, select, label, textarea { font-family: 'IBM Plex Sans', sans-serif; } </style>
- Get a font file that you've set as font-family, and save it to system's default font directory.
- To make sure if it's installed properly, run
fc-list
and check if the font is on the list.To save your time, I recommend using Google Web Fonts Helper to download font files.
This worked for me, Thank you!!!!
and don't forget fc-cache -fv
For Feature Requests
Desired Feature:
For Bug Reports
Expected Behavior
Current Behavior
Steps to Reproduce
after installation, login as admin, write chinese , then export from webpages.