HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › HTML/CSS rendering issues › PD4PageMark and header/footer height for different pages

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26750

    Hi there,

    I’m currently evaluating PD4ML and all going well apart from the following issue. I have extended PD4PageMark to supply different HTML for the first page header/footer from the subsequent pages. For example, each header/footer would be defined by:

    public class DifferingPageMarker extends PD4PageMark {
    
    protected String firstPageHtml;
    protected String otherPageHtml;
    
    public DifferingPageMarker(String firstPageHtml, String otherPageHtml) {
    super();
    this.firstPageHtml = firstPageHtml;
    this.otherPageHtml = otherPageHtml;
    setAreaHeight(-1);
    }
    
    @Override
    public String getHtmlTemplate(int pageNumber) {
    if(pageNumber == 1) {
    return firstPageHtml;
    }
    return otherPageHtml;
    }
    }

    The problem is that the subsequent footer/headers seem to adhere to the first page header/footer heights – so if the first header/footer is large/small, the second header/footer takes up the same space, even if the content is smaller/larger.

    Any help would be appreciated – am I not supplying the height correctly? Should I be doing this in a different way?

    Kind Regards,
    Rob

    #29056

    You are faced with a limitation of header/footer API of PD4ML. If you need different header or footer heights depending on page, you have to use inline definitions and

    See https://pd4ml.com/cookbook/pdf_header_footer_generation.htm

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘HTML/CSS rendering issues’ is closed to new topics and replies.