shelfio / chrome-aws-lambda-layer

58 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli
MIT License
637 stars 45 forks source link

Incorrect fonts in result pdf #34

Closed LLDmitry closed 2 years ago

LLDmitry commented 3 years ago

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/

vladholubiev commented 2 years ago

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)