PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: Different Header / Footer based on page number
   PostPosted: 04 Nov 2011, 15:15 
I would like to know if its possible to use a different header / footer based on the page number. This is practical for printing books, where the outside edge should contain the page number. This is only possible if you can reverse the header / foot template based on even / odd page number. Thanks in advance!


  Subject: Re: Different Header / Footer based on page number
   PostPosted: 15 Nov 2011, 11:57 
You can find general info regarding PD4ML headers/footers by the link:
html-pdf-faq-f1/pdf-page-headers-footers-definition-options-t41.html

The third option allows you to define with scope attribute where a particular header/footer should appear. You may define multiple <pd4ml:page.header> tags with different scopes.

If you prefer to define headers/footers via API, you need to override corresponding methods of PD4PageMark. For example:
PD4PageMark footer = new PD4PageMark() {
	public String getHtmlTemplate(int pageNumber) {
		if ( pageNumber % 2 == 0 ) {
			return "<html><body>some left aligned stuff...";
		} else {
			return "<html><body>some right aligned stuff...";
		}
	}
};
pd4ml.setPageFooter(footer);


The above example defines page-specific HTML footer. Such type of footers is not supported by PD4ML Std. For the Std verison you may override:

PD4PageMark.getPageNumberTemplate(int pageNr);
PD4PageMark.getPageNumberAlignment(int pageNr);
PD4PageMark.getTitleTemplate(int pageNr);

etc



[Reply]     [ 2 posts ] 

cron
Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share