HTML to PDF footerHtml and headerHtml don't work via REST API


#1

Hi

I’m testing the REST API for a production app, but it seems that the headerHtml and footerHtml are ignored?

I’m sending the below test body to this endpoint: https://api.plumsail.com/api/v1/Documents/Html2Pdf

{
  "html": "<!doctype html><html><head> <meta charset='utf-8'> <title>HTML to PDF example</title></head><body><header><p>headertext in normal html</p></header> <div> Text in box1 </div><div> Text in box2 </div><footer><div> Text in Footer </div></footer></body></html>",
  "headerHtml": "<!doctype html><html><body><header><p>Real header here doesn't work</p></header></body></html>",
  "footerHtml": "<!doctype html><html><footer><div>Real footer here doesn't work</div></footer></html>",
  "size": "A4",
  "orientation": "Portrait",
  "margins": "5"
}

All content in the html property of the request is rendered in the PDF successfully, but again, all content in the headerHtml and footerHtml is ignored. Is it a bug in the API or am I sending wrong content?

I have also tried with: <footer><div>Real footer here doesn't work</div></footer>

Thanks,
Jeppe


#2

Hello @Jeppe,

The right format for header/footer is:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
This is header
</body>
</html>

Best regards,
Petr Bushuev
Plumsail Team