Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #26624

    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!

    #28711

    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 tags with different scopes.

    If you prefer to define headers/footers via API, you need to override corresponding methods of PD4PageMark. For example:
    [language=java:2gds8h30]PD4PageMark footer = new PD4PageMark() {
    public String getHtmlTemplate(int pageNumber) {
    if ( pageNumber % 2 == 0 ) {
    return “some left aligned stuff…”;
    } else {
    return “some right aligned stuff…”;
    }
    }
    };
    pd4ml.setPageFooter(footer);[/language:2gds8h30]

    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

    #28712

    I am currently evaluating this software, before deciding to buy the full license. It looks like there might be a limitation with regards to headers and footers. The example above demonstrates how to define page specific content, but as far as I can see there is no way to set page specific areaHeight.

    I would like to render my first page without a header:
    [language=Java:1fdcwkd1]PD4PageMark out = new PD4PageMark();
    out.setHtmlTemplate(“…some header…”);
    out.setPagesToSkip(1);
    out.setAreaHeight(-1);[/language:1fdcwkd1]

    The header is not displayed in the pdf, but the space it occupies (in subsequent pages) pushes the content down. Is there a way to solve this?

    #28713

    It is a functional limitation of the header/footer type. PD4ML supports 3 header/footer types – see http://pd4ml.com/cookbook/pdf_header_footer_generation.htm

    An inline header should solve the issue.

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

The forum ‘General questions / FAQ’ is closed to new topics and replies.