PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) General questions / FAQ Is it possible to set header/footer scope via the API? Re: Re: Is it possible to set header/footer scope via the API?

#27836

It is possible with overriding of template methods. For example the code below defines different footers for even and odd pages.

[language=java:ajrznd4t]PD4PageMark footer = new PD4PageMark() {
public String getHtmlTemplate(int pageNumber) {
if ( pageNumber % 2 == 0 ) {
return “…template 1…“;
} else {
return “…template 2…“;
}
}
};
footer.setAreaHeight(50);[/language:ajrznd4t]

Please take into account – even if you define return “”; for some pages there, it will allocate the defined footer space 50px anyway.

footer.setAreaHeight(-1); autocomputes the footer heigh using the template code, returned for the first page.

The following methods of PD4PageMark are overridable:

  • String getHtmlTemplate( int pageNumber )
  • Color getPageBackgroundColor( int pageNumber )
  • String getPageBackgroundImageUrl( int pageNumber )
  • String getPageNumberTemplate( int pageNumber )
  • String getTitleTemplate( int pageNumber )
  • Font getFont( int pageNumber )