DEV Community

Discussion on: Generate a PDF in AWS Lambda with NodeJS and Puppeteer

Collapse
 
akirautio profile image
Aki Rautio

The result of the PUG template used in an article looks like this:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>PDF Generator</title>
    <style>
      body {
        font-family: Helvetica;
      }
      h1 {
        font-size: 36px;
        border-bottom: 1px solid black;
      }
      h3 {
        font-size: 16px;
      }
    </style>
  </head>
  <body>
    <h1>Monthly report</h1>
    <h3>January - 2020</h3>
    <div id="body">Here comes the values</div>
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

So I would guess HTML part is okay. I would suggest to debug the setup by trying the code only with puppeteer and simple html and then including javascript elements to pinpoint the part where it starts to fail.