PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) HTML/CSS rendering issues How to find out if a page break has occurred

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #26564

    i’m having big trouble to implement a simple customer request: in a report that includes data concerning some countries, the customer wants the country name as a headline, and if the data of one country spreads over several pages, the customer wants the headline to be changed to “Country name (continued)”.
    Now i have no clue how to implement that (tbh, at the moment i’m counting the printed lines of the report and manually adding the pagebreaks, but that is not the most stable solution)

    I’ll give an (dummy) example of the report (Top Car Sales per Country)

    — REPORT START —
    Italy
    – Fiat 500

    Germany
    – Audi A1
    – BMW 3

    — PAGE BREAK —

    Germany (continued)
    – VW Golf
    – Skoda Fabia
    – Dacia Logan

    — PAGE BREAK —

    Switzerland
    – Dunno
    – Foo

    Austria
    – Bar

    –PAGE BREAK —

    Austria (continued)
    – Some other thing

    #28545

    After doing a lot of thinking (and having solved the problem by “guessing” the size of the content before it is beeing passed to pd4ml), i think a possible solution would be to implement a feature that makes it possible to define two page headers, one for “the next pagebreak”, and one for “the pagebreaks after that”.

    Any thoughts about that?

    #28546

    PD4ML can repeat a table header after a page break (pd4ml.enableSmartTableBreaks(true)). But it does not allow to add, for example, “(continued)” to the original header. So probably the trick with table headers will work for you.

    PD4ML Pro allows you to define page-specific headers in a case you use tag.

    1. The tag supports scope attribute. For example: scope=”1″ defines header for the first page only; meaning of scope=”2+”, scope=”4-5″ is hopefully obvious. On the top of HTML page you may define multiple tags with different scope attribute values.

    2. Also without scope attribute may appear somewhere in the document body. In the case it impacts all subsequent pages (until it is overridden by another tag)

    For your sample in theory it should be like that:
    [language=xml:12j8bljf]Italy.


    Italy (continued)


    item
    item
    item
    item
    item
    item
    item
    item  [/language:12j8bljf]

    However I tested the code and it does not work as desired. In a case of multiple header definitions/redefinitions on a single page only the last header definition takes effect. We’ll check if it possible to improve the algorithms to support the above idea.

    #28547

    That’s excellent news!
    I’ll check the version log now and then to see if i can refactor my quite bad solution.

    #28548

    @Guest wrote:

    I’ll check the version log now and then to see if i can refactor my quite bad solution.

    • Drink coffee
    • Boot brains
    • Post in forums
    #28549

    I think I’ve found a solution: avoid having to know about the pagebreaks.
    The trick is to unset/set the page headers the way shown to prevent having the country name printed twice.
    The issue reported in this thread (multiple page headers) is fixed in version 3.8.

    I will not adapt the example to fit the older examples 🙂

    <br /> <table style="page-break-inside: avoid;"><br /> <pd4ml:page.header><br /> </pd4ml:page.header><br /> <tr><br /> <th>Italy</th><br /> </tr><br /> <tr><br /> <td>Item 1</td><br /> </tr><br /> </table><br /> <pd4ml:page.header><br /> <table><br /> <tr><br /> <th>Italy (Continued)<br>Company 1</th><br /> </tr><br /> </table><br /> </pd4ml:page.header><br /> <table><br /> <tr><br /> <td>Item 2</td><br /> </tr><br /> ...<br /> </table><br /> <pd4ml:page.header><br /> <tr><br /> <th>Italy (Continued)</th><br /> </tr><br /> </pd4ml:page.header><br /> <table style="page-break-inside: avoid;"><br /> <tr><br /> <td>Company 2</td><br /> </tr><br /> <tr><br /> <td>Item 1</td><br /> </tr><br /> </table><br /> <pd4ml:page.header><br /> <table><br /> <tr><br /> <th>Italy (Continued)<br>Company 2</th><br /> </tr><br /> </table><br /> </pd4ml:page.header><br /> <table><br /> <tr><br /> <td>Item 2</td><br /> </tr><br /> ..<br /> </table>

    Output:
    Italy
    Company 1
    Item 1
    Item 2
    Item 2
    Item 3
    Item 4
    Item 5
    Item 6
    Item 7
    Item 8
    Item 9
    <>
    Italy (Continued)
    Company 2
    Item 1
    Item 2
    Item 2
    Item 3
    Item 4
    Item 5
    Item 6
    Item 7
    Item 8
    Item 9
    <
    >
    Italy (Continued)
    Company 2
    Item 10
    Item 11
    Item 12
    Item 13
    Item 14
    Item 15
    Item 16

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

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