Custom Static Javascript HTML to PDF

I am trying to make invoices for my static website. I am trying to convert an HTML page to a PDF page. I been doing static websites rather than Node.JS because I can’t host Node.JS websites. What have I done wrong?

What have I tried

invoices.html

<!DOCTYPE html>
<html>
  <head>
    <style>
      html,
      body {
        padding: 0;
        margin: 0;
      }
      iframe {
        width: 100%;
        height: 100%;
        border: 0;
      }
    </style>
  </head>
  <body>
    <iframe
      srcdoc="<p>Hello world!</p>"
      src="invoices.html"
      type="application/pdf"
    ></iframe>
  </body>
</html>

Result

I have gotten the "Hello World" to display but it was just in a html page rather then a PDF page.

30 thoughts on “Custom Static Javascript HTML to PDF”

Leave a Comment