Search code examples
javascriptnode.jspdf-generationpuppeteer

puppeteer on linux and windows give different results


Here is a difference between result pdf on windows and linux. When I'm trying to generate from linux images disappears.

That chart images source is dataUrl of canvas

Linux(WSL): linux pdf

Windows: windows pdf

pdf render:

const puppeteer = require('puppeteer')

async function printPDF() {
  const browser = await puppeteer.launch({headless: true, args: ['--no- sandbox', '--disable-setuid-sandbox']});
  const page = await browser.newPage();
  await page.goto('http://localhost:8080/new', {waitUntil: 'networkidle0'});
  const pdf = await page.pdf({ format: 'A4', printBackground: true, path: __dirname+'/s.pdf' });

  await browser.close();
  return pdf
}
printPDF();

Solution

  • There is for sure a minor problem with a whitespace character in --no- sandbox

    Should be --no-sandbox