DocRaptor

Headers and Footers in PDFs with DocRaptor

DocRaptor Support gets asked a lot if there’s support for headers and footers. The answer is a most definite YES!

We use Prince XML to product PDFs. As such, there are some specialty CSS rules that can be used to create consistent headers and footers for your PDFs. Here’s the Prince XML page header and footer documentation.

A simple example and output are below.

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <style type="text/css">
      @page {
        font-size: 200%;
        @top {
          content: "header";
          background-color: #eee;
        }
        @bottom {
          content: "footer";
          background-color: #eee;
        }
      }
    </style>
  </head>
  <body>
  </body>
</html>

After running it against DocRaptor, you should get a doc that looks like this: header and footer sample image

Downloads