Forum Bugs

counters over multiple HTML pages

RBK
Hi again!

Except from some built-in counters like page, counters seem to be reset when Prince generates one PDF from multiple HTML documents.

To demonstrate my problem, I attach two HTML files and a CSS file to demonstrate the effect. The command prince d1.html d2.html -o test.pdf creates a PDF file with two pages, but the value of counter Level0 is apparently 1 on both pages even though it should have been incremented by the body element and there is nothing around that resets it.

Is this a bug or a feature?
  1. counters.zip1.2 kB
mikeday
Difficult to say bug or feature, at the moment it's just a fact. :)

Counters and some other state are reset between multiple documents; links between documents will work. Possibly this behaviour could be adjusted.
gordonski
Hi!
I know I'm responding to a very old request, but has there been any progress on this one? I'm trying to do a similar thing: I convert multiple html files to one combined pdf document, which contains images with captions. Via css I prepend the text
'Image ' counter(image-counter) ': '
to each caption text (after incrementing the counter, of course). Works well for the first html file but since for the following files no counter-reset is made (I want to keep the value!) there is no active instance of the variable and thus image-counter always returns the value 1.
It would be great if you could give me some advice how to solve this. Could the value of a counter be eventually passed from one html file processing to another, so I could do a counter-reset with the current value for each new file?
mikeday
Perhaps in the future we could arrange something with JavaScript to persist the value across different documents? Currently there are still something like this that are easier to achieve by simply concatenating the documents into one.
gordonski
Thanks for the fast reply!
I see, then I will probably concatenate the html files as you suggested, or find a way to insert the image numbers into the html beforehand.