Open GuyMoreh opened 2 years ago
module.exports.handler = async (event, context, callback) => { let result = null; let browser = null; let bodyContent = event.data; let headerTemplate = event.headerTemplate || '' let footerTemplate = event.footerTemplate || '' try { await chromium.font('https://s3.ap-northeast-2.amazonaws.com/fonts/webfont.ttf') <--here console.log(event) browser = await chromium.puppeteer.launch({ args: chromium.args, defaultViewport: chromium.defaultViewport, executablePath: await chromium.executablePath, headless: chromium.headless, ignoreHTTPSErrors: true, });
Hello. I solved this by following @Curryking100k 's code. Add this part.
await chromium.font('https://s3.ap-northeast-2.amazonaws.com/fonts/webfont.ttf') // Add font for chromium
For the font link, I suggest you to use Noto Sans SC font. I tried normal Noto Sans font but it didn't work for me.
So I downloaded NotoSansSC-Regular.ttf, and uploaded to my S3 bucket, and then used the S3 link. It worked now. (Also supporting Japanese)
Hey,
Thanks for the great library!!
I'm using this library to generate pdfs, but non-english characters are displayed as blocks.
I have tried to follow this issue (https://github.com/alixaxel/chrome-aws-lambda/issues/108) but the results are the same...
Can anyone please provide a guide or something??
Versions:
Thanks!