Skip to content

export PDF with chinese #5770

@mattwang6868

Description

@mattwang6868

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

This method it's works for me.

I choose using PHP-based default PDF rendering system "dompdf"
I found a utility at dompdf github page
It can convert TTF font files into font libraries for use with dompdf.
step 1.
Download utils to /bookstack/vendor/dompdf/

step 2.
modify two lines in /utils/load_font.php


require_once "/bookstack/vendor/autoload.php";
$fontDir = "path to your chinese ttf file";


step 3.
run "php load_font.php 'font name what you want' path to your chinese ttf file"

step 4.
It will generate an installed-fonts.json file in the /bookstack/storage/fonts directory, which will include the font name.

step 5.
Go to “Custom HTML Head Content” customization setting and add chinese fonts name.

body, h1 {
--font-body: ......, "noto sans tc";
}

step 6.
refresh browser and export pdf.

Exact BookStack Version

v25.05.2

Log Content

 

Hosting Environment

php-8.2.29
almalinux8.10
bookstack v25.05.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions