DocPublisher‎ > ‎3. How to‎ > ‎

How to print header on all printed pages


Description:

When printing HTML documents, previously defined print header appears only on top of the first printed page. Sometimes it might be necessary to print header on top of each printed page.


Solution:

Here is the piece of JavaScript that should make it possible for you to print header on each printed page:
 

<script>

function jsAddDocTitle()
{

 var ifrm = window.frames["ifrmPrint"];

 if(!window.clientInformation || ifrm.document.readyState == "complete")
 {

  var d = new Date();

  ifrm.document.title = "UNCONTROLLED " + " - PRINTED ON " + d.toString();

 }

}


var ifrm = window.frames["ifrmPrint"];

if(ifrm != null)

 if(window.clientInformation)

  ifrm.attachEvent("onbeforeprint", jsAddDocTitle);

</script>

 

To make it work, this code snippet should be added to the active print header.

In this sample, "UNCONTROLLED - PRINTED ON <current_date>" prints on each page, but the JavaScript code can be customized to print something else.

Comments