shelfio/chrome-aws-lambda-layer

Incorrect fonts in result pdf

LLDmitry opened this issue · 1 comments

If we try to convert html with cyrillic letters to pdf, we get encoded text. As i understand AWS has restricted set of fonts. If we need, we should provide additional fonts in the new lambda layer. Is it correct way (i've tried but result pdf still the same) ?-
create a directory named .fonts and place any font faces you want there:
.fonts
├── NotoColorEmoji.ttf
└── Roboto.ttf
Afterwards, you just need to ZIP the directory and upload it as a AWS Lambda Layer:
zip -9 --filesync --move --recurse-paths .fonts.zip .fonts/

That didn't work for me. But what worked -- is this:

await chromium.font(
    'https://rawcdn.githack.com/googlefonts/noto-cjk/edd93792aba94103aacb793310a412390303f990/Sans/Variable/TTF/NotoSansCJKjp-VF.ttf'
  );

Just change the URL to the Cyrillic fontset (the one in my example is for asian languages)