title: Puppeteer-PDF: Node hangs when I try to generate a PDF
body: <p>I using Puppeteer to generate a PDF file. In my laptop (Windows 10) it works very well, but in the server (Windows Server 2012 R2) it hangs when it try to generate the PDF and it ends with time out error.</p>
  <p>Here I set the variables and I call generatePdf() function</p>
  <pre><code>let html = '&lt;html here....&gt;';
  pathPdf = 'c:\path\file.pdf'
      
  const pdf=this.generatePdf();
      pdf.then(
          function (){
              res.status(200).send([{path: pathPdf}]);
          })
      .catch(
          function(val){
              res.status(500).send([val.message, val]);
      });
  </code></pre>
  <p>And the function that generates the PDF with Puppeteer:</p>
  <pre><code>this.generatePdf = async function() {
      return new Promise(async function(resolve, reject) {
          try {
              const browser = await puppeteer.launch({
                  headless: true
              });
              const page = await browser.newPage();
              page.setContent(html);
              //page.setDefaultNavigationTimeout(0)
              const buffer = await page.pdf({
                  path: pathPdf,
                  format: &quot;A4&quot;,
                  printBackground: true,
                  displayHeaderFooter: true,
                  footerTemplate: `
                  &lt;div style=&quot;font-size: 10px; padding-top: 5px; text-align: right; width: 100%; margin-right: 35px&quot;&gt;
                  &lt;span&gt;Page&lt;/span&gt; &lt;span class=&quot;pageNumber&quot;&gt;&lt;/span&gt; de &lt;span class=&quot;totalPages&quot;&gt;&lt;/span&gt;
                  &lt;/div&gt;
                  `,
                  margin: {
                      bottom: 70, // minimum required for footer msg to display
                      left: 25,
                      right: 35,
                      top: 30,
                  },
              });
              resolve();
              console.log('Bufffer', buffer);
              await browser.close();
              //res.end(buffer);
              console.log(buffer) // maybe do response(pdf).type('x-pdf')
          } catch (e) {
              console.log('Error', e);
              reject(e);
          }
      });
  }
  </code></pre>