RelaxedJS / ReLaXed

Create PDF documents using web technologies
ISC License
11.8k stars 428 forks source link

Repeating UL header across page breaks #65

Closed frankandrobot closed 6 years ago

frankandrobot commented 6 years ago

Given the following page structure

 ul 
     li   item 1
     li   item 2
<!--  start of next page -->
     li   item 3

Is there a way to automatically insert a custom header a start of the next page... but only if the list breaks?

The use case is that I'm adapting the resume example. The "experience" section (which is just a list) flows into the second page, and I'd like a way to automatically inject a second header "experience (cont)"... but only if the list expands into the next page

Zulko commented 6 years ago

There was an attempt to introduce "list headings" in HTML a few years back but it was rejected, certainly by people who didn't want multi-page resumes to become a thing. One workaround would be to use border-less one-column tables instead of list. Tables have a header, and when a table gets cut into several pages, the header is copied on top of all these sub-tables.

frankandrobot commented 6 years ago

i seem to recall princexml (which if you haven't heard of it, does exactly the same thing this does but is closed source) has this feature. The use case is books... You have a list and it breaks, you want an automatic header in the start of the next page. More generally, something breaks across pages, and you often want an optional element inserted at the start of the next page.

Zulko commented 6 years ago

Yeah I know, Prince has a lot more editing-related features because that's what the software is about. ReLaXed is basically a wrapper around Chrome, and as such it has all of Chrome's limitations. Some can be overcome by pre-processing, but list headers is not one of them.

This being said, ReLaXed will certainly have many features in the future that Prince doesn't have (right now, Pug support and diagrams support).

I'm closing this as I don't believe it will get sorted soon. But Chrome could improve in the future.