Forum How do I...?

Table in PDF : clone a row (<tr>) and insert clone as next page first child

Jerem
Hello guys 😊
The PDF displays a watch list in a very long table (90 pages).
The table header is repeated at the top of each page.

We have collections. Collections have models and models have variations (sometimes a lot).
If a page starts by a variation, it’s bad, because we need to look at the previous page to know the model of this variation.
If a page starts by a collection or a model, it’s OK, I don’t want to do anything.

So I want to detect the first element of each page.
If it’s a variation (and only in this case), I want to clone the previous model (<tr class=”model”>) and add it as the first element of the page (just before the variation).
The complex thing is that a model can start at any point of the page, the number of variations for each model varies a lot, and the height of each variation (multi languages) varies a lot.

The document is a big table like this:

(page 1)
<tr class=”collection 1”>
<tr class=”model 1”> // model
<tr class=”variation”>
<tr class=”variation”>
<tr class=”variation”>
<tr class=”variation”>
<tr class=”model 2”> // model to be cloned
<tr class=”variation”>
<tr class=”variation”>

(page 2)
<tr class=”variation”> ==> first item of the page is a variation ==> I want to insert a "model 2" clone here before the variation
<tr class=”variation”>
<tr class=”variation”>

Thank you 😊
howcome
Dynamic table headers is a valid use case, much similar to running headers/elements.

Here's a slightly different proposal, one that also might work in your case?:

https://css4.pub/2023/boxtracking/#dynamic-table-headers

That is, the example supports dynamic headers by hiding elements, rather than cloning them.

Edited by howcome

Jerem
Hello,
Thanks for your reply :)

I will wait for the client feedback before considering working on this because for now he seems to like the result (it's my personal opinion that it's bad to start with a variation !).

So I hope I won't have to address this at all :)

I keep you posted