chrome-aws-lambda icon indicating copy to clipboard operation
chrome-aws-lambda copied to clipboard

[BUG]

Open lobbin opened this issue 4 years ago • 0 comments

Sorry for old bug report, but the problem is still in the latest release. Between 5.5.0 and 6.0.0, something changed in regards to handling of fonts. 5.5.0 works as expected where every release after doesn't work. Problem is that it simply doesn't care that I've loaded an extra font to handle the Chinese characters.

Environment

  • chrome-aws-lambda Version: >5.5.0
  • puppeteer / puppeteer-core Version: >5.5.0
  • OS: Linux
  • Node.js Version: 12.x
  • Lambda / GCF Runtime: nodejs12.x

Expected Behavior

Chinese characters to be correctly rendered

Current Behavior

Getting square boxes

Steps to Reproduce

  await chromium.font(baseUrl + '/fonts/NotoSansSC-Regular.otf')
  const browser = await chromium.puppeteer.launch({
    args: chromium.args,
    defaultViewport: chromium.defaultViewport,
    executablePath: await chromium.executablePath,
    headless: true,
    ignoreHTTPSErrors: true,
  })

  const page = await browser.newPage()
  await page.setContent(html, { waitUntil: 'networkidle2' })

  const buffer = await page.pdf({
    format: 'A4',
    displayHeaderFooter: true,
    headerTemplate: '<span></span>',
    footerTemplate: '<span></span>',
    printBackground: true,
    margin: {
      top: '80px',
      bottom: '70px',
      left: '40px',
      right: '40px',
    }
  })

Possible Solution

lobbin avatar Aug 25 '21 09:08 lobbin