Skip to content

Commit

Permalink
Merge pull request #9532 from weseek/imprv/157249-159175-pdf-bulk-exp…
Browse files Browse the repository at this point in the history
…ort-for-chinese

add fonts (lato and noto-cjk)
  • Loading branch information
yuki-takei authored Dec 31, 2024
2 parents be9189f + 957db03 commit 2394931
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/pdf-converter/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Instal additional packages
sudo apt update
sudo apt-get install -y --no-install-recommends \
chromium locales fonts-ipafont fonts-ipaexfont fonts-ipafont-gothic fonts-ipafont-mincho
chromium fonts-lato fonts-ipafont-gothic fonts-noto-cjk
sudo apt-get clean -y

# Setup pnpm
Expand Down
2 changes: 1 addition & 1 deletion apps/pdf-converter/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ENV LANG="ja_JP.UTF-8"
ENV optDir="/opt"
ENV appDir="${optDir}/pdf-converter"

RUN apt-get update && apt-get install -y chromium locales fonts-ipafont fonts-ipaexfont fonts-ipafont-gothic fonts-ipafont-mincho \
RUN apt-get update && apt-get install -y chromium fonts-lato fonts-ipafont-gothic fonts-noto-cjk \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*; \
echo "ja_JP UTF-8" > /etc/locale.gen && locale-gen;
Expand Down
7 changes: 7 additions & 0 deletions apps/pdf-converter/src/service/pdf-convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ class PdfConvertService implements OnInit {

await this.puppeteerCluster.task(async({ page, data: htmlString }) => {
await page.setContent(htmlString, { waitUntil: 'domcontentloaded' });
await page.addStyleTag({
content: `
body {
font-family: 'Lato', 'IPAGothic', 'Noto Sans CJK';
}
`,
});
await page.emulateMediaType('screen');
const pdfResult = await page.pdf({
margin: {
Expand Down

0 comments on commit 2394931

Please sign in to comment.