PDF Page Headers and Footers

<< Click to Display Table of Contents >>

Navigation:  Designing Templates > Publisher Settings >

PDF Page Headers and Footers

PDF128
Adding Page Headers and Footers to PDF Documentsanimatedlink

 

When designing your Templates you can designate parts of your documents to be used as a page header or as a page footer simply by adding a couple of tags to the HTML source code. At runtime the template compiler will actually remove these sections from your HTML document and insert them back into the PDF document as it's being created. Just remember that when creating the Header and Footer you will want to keep them SMALL, just 2 or 3 lines at most.

 

You can also use the PDF Options in the Publisher Settings to set the Top and Bottom margins the publisher will use when creating Adobe PDF documents. See the examples below for details on how to add page headers and footers to your templates.

 

Inserting A Page Header

Just add a <header> element at the top of the <body> of your xHTML document as shown below.

 

<body class="mainbody">
      <header>
          <p style="margin: 0;text-align: center; font:14pt Tahoma; font-weight: 700;">

         Working With Repeating Segments
              <span style="font:8pt Tahoma; font-weight: 100;"><br/>

         <b>System Date:</b> ##TODAY## ##NOW##</span>
          </p>
      <hr/>
      </header>
      <table>
          <tr style="font:10pt Tahoma;color:black; padding-top: 2px; padding-left: 2px;">
              <td><img src="##IMAGES.healthcareshield" style="width:77px;height:77px;" /></td>
              <td>
                <strong>ID: </strong>##HL7.PID.3.1## <strong>Account: </strong>##HL7.PID.18.1##
                <strong>SSN: </strong>##HL7.PID.19.1##<br />
                <strong>Name: </strong>##HL7.PID.5.1##, ##HL7.PID.5.2## ##HL7.PID.5.3##<br />
                <strong>DOB: </strong>##HL7.PID.7.1.date## <strong>Gender: </strong>
                ##HL7.PID.8.1##<br />
                <strong>Phone: </strong>(H) ##HL7.PID.13.1## (W) ##HL7.PID.14.1##
              </td>
          </tr>
      </table>

 

Inserting a page header is really very straight forward and easy to understand. Most templates you create might have some part at the very top of the HTML which you wish could be repeated as a page header when the document is printed or exported into a PDF document but just displayed in the browser when exported as HTML. Page footers represent a slightly different challenge. See below.

 

 

Inserting A Page Footer

 

Typically the main purpose of the page footer is to show page numbering. In the example code below note the use of the special Template Macros ##PDFPAGENUMBER and ##PDFPAGECOUNT. Just add a <footer> element at the end of the <body> of your xHTML document as shown below.

 

<body class="mainbody">

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

  ....HTML CODE....

    <footer>
       <hr />
        <table style="width:100%;margin: 0; font:8pt Tahoma;color:black; padding-top: 1px; padding-left: 2px;">
            <tr>
                <td style="text-align: left;">
                    <b>Template:</b> ##TEMPLATENAME
                </td>
                <td style="text-align: center;">
                    - ##PDFPAGENUMBER of ##PDFPAGECOUNT -
                </td>
                <td style="text-align: right;">
                    <b>Created With:</b> ##TEMPLATESOFTWARE <b>Version: </b>##TEMPLATESOFTWAREVERSION
                </td>
            </tr>
        </table>
      </footer>
</body>

 

 


 

 

Inserting A Page Header

(Old Method Notepad V3)

 

 

 

Example Code from the Examples and Tutorials Library:

 

<body class="mainbody">
      <pdfpageheader>
          <p style="margin: 0;text-align: center; font:14pt Tahoma; font-weight: 700;">

         Working With Repeating Segments
              <span style="font:8pt Tahoma; font-weight: 100;"><br/>

         <b>System Date:</b> ##TODAY## ##NOW##</span>
          </p>
      <hr/>
      </pdfpageheader>
      <table>
          <tr style="font:10pt Tahoma;color:black; padding-top: 2px; padding-left: 2px;">
              <td><img src="##IMAGES.healthcareshield" style="width:77px;height:77px;" /></td>
              <td>
                <strong>ID: </strong>##HL7.PID.3.1## <strong>Account: </strong>##HL7.PID.18.1##
                <strong>SSN: </strong>##HL7.PID.19.1##<br />
                <strong>Name: </strong>##HL7.PID.5.1##, ##HL7.PID.5.2## ##HL7.PID.5.3##<br />
                <strong>DOB: </strong>##HL7.PID.7.1.date## <strong>Gender: </strong>
                ##HL7.PID.8.1##<br />
                <strong>Phone: </strong>(H) ##HL7.PID.13.1## (W) ##HL7.PID.14.1##
              </td>
          </tr>
      </table>

 

Inserting a page header is really very straight forward and easy to understand. Most templates you create might have some part at the very top of the HTML which you wish could be repeated as a page header when the document is printed or exported into a PDF document but just displayed in the browser when exported as HTML. Page footers represent a slightly different challenge. See below.

 

 

Inserting A Page Footer

(Old Method Notepad V3)

 

Typically the main purpose of the page footer is to show page numbering. In the example code below note the use of the special Template Macros ##PDFPAGENUMBER and ##PDFPAGECOUNT. Since these special use macros are ONLY evaluated when a PDF document is being created you will likely want to "hide" the page footer (or header if you use the page numbers there) from normal HTML or HL7 Document output. Note the use of the hidden <div> element in the example below.

 

Example Code from the Examples and Tutorials Library:

 

    <div style="display:none;">
    <pdfpagefooter>
       <hr />
        <table style="width:100%;margin: 0; font:8pt Tahoma;color:black; padding-top: 1px; padding-left: 2px;">
            <tr>
                <td style="text-align: left;">
                    <b>Template:</b> ##TEMPLATENAME
                </td>
                <td style="text-align: center;">
                    - ##PDFPAGENUMBER of ##PDFPAGECOUNT -
                </td>
                <td style="text-align: right;">
                    <b>Created With:</b> ##TEMPLATESOFTWARE <b>Version: </b>##TEMPLATESOFTWAREVERSION
                </td>
            </tr>
        </table>
      </pdfpagefooter>
    </div>