BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.28k stars 1.9k forks source link

export a page with Chinese characters to PDF #4196

Closed jasonyunliang closed 1 year ago

jasonyunliang commented 1 year ago

Attempted Debugging

Searched GitHub Issues

Describe the Scenario

when i tried to export a page with Chinese characters. the characters will not be recoginzed in PDF file as below.

1682404686665

please help check. thanks.

Exact BookStack Version

v23.02.3

Log Content

No response

PHP Version

No response

Hosting Environment

set up by docker-compose.

ssddanbrown commented 1 year ago

Hi @jasonyunliang, Yeah, this is a known issue and is already open in #148 and #719. Hence I'm going to close this off as a duplicate. Also referenced in #2182 and #1964.

I have previously suggested using our wkhtmltopdf option as a workaround, but this has security implications and may not be available in your docker environment.

huangs639 commented 12 months ago

Hi @jasonyunliang, Yeah, this is a known issue and is already open in #148 and #719. Hence I'm going to close this off as a duplicate. Also referenced in #2182 and #1964.

I have previously suggested using our wkhtmltopdf option as a workaround, but this has security implications and may not be available in your docker environment.

Hi @ssddanbrown, I cannot found /usr/bin/wkhtmltopdf in linuxserver/bookstack docker image(TAG 23.06.2), has it been removed from the docker image? Do you have plan to support it again in subsequent versions?

tli47 commented 6 months ago

Hi @jasonyunliang, Yeah, this is a known issue and is already open in #148 and #719. Hence I'm going to close this off as a duplicate. Also referenced in #2182 and #1964. I have previously suggested using our wkhtmltopdf option as a workaround, but this has security implications and may not be available in your docker environment.

Hi @ssddanbrown, I cannot found /usr/bin/wkhtmltopdf in linuxserver/bookstack docker image(TAG 23.06.2), has it been removed from the docker image? Do you have plan to support it again in subsequent versions?

Hi, wkhtmltopdf is removed from the official image, you need to make a new docker image that contains wkhtmltopdf. My Dockerfile is below for your reference, please note: I also install SimSun.ttf that supports chinese font, make sure SimSun.ttf existence if you use the following Dockerfile.

FROM surnet/alpine-wkhtmltopdf:3.16.2-0.12.6-full as wkhtmltopdf

COPY SimSun.ttf /usr/share/fonts/SimSun.ttf

FROM lscr.io/linuxserver/bookstack

RUN echo -e http://mirrors.ustc.edu.cn/alpine/v3.7/main/ > /etc/apk/repositories
RUN echo -e https://mirrors.aliyun.com/alpine/v3.17/community >> /etc/apk/repositories
#RUN echo -e http://dl-cdn.alpinelinux.org/alpine/v3.7/community >> /etc/apk/repositories

# Install dependencies for wkhtmltopdf
RUN apk add --no-cache \
     libxrender \
     openssl1.1-compat \
     fontconfig \
     freetype \
     ttf-dejavu \
     ttf-droid \
     ttf-freefont \
     ttf-liberation \
  && mkfontscale && mkfontdir && fc-cache -f

# RUN mkdir -p /usr/share/fonts/win
COPY --from=wkhtmltopdf /usr/share/fonts/SimSun.ttf /usr/share/fonts/SimSun.ttf

# Copy wkhtmltopdf files from docker-wkhtmltopdf image
COPY --from=wkhtmltopdf /bin/wkhtmltopdf /bin/wkhtmltopdf
COPY --from=wkhtmltopdf /bin/wkhtmltoimage /bin/wkhtmltoimage
COPY --from=wkhtmltopdf /bin/libwkhtmltox* /bin/