Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Issue in dynamic header and footer to each page in wikihtmltopdf #2299

Closed
munish-usit opened this issue Apr 13, 2015 · 1 comment
Closed

Comments

@munish-usit
Copy link

I need to give dynamic header to every page in wikihtmltopdf. Every page header should contain a section and subsection.

Currently, I am able to do this with code

<html><head><script>
  function subst() {
    var vars={};
    var x=window.location.search.substring(1).split('&');
    for (var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
    var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
    for (var i in x) {
      var y = document.getElementsByClassName(x[i]);
      for (var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
    }
  }
  </script></head><body style="border:0; margin: 0;" onload="subst()">
   <span class = "section"></span>
   <hr/>
   <span class = "subsesction"></span>
  </body></html>

But this code is failing under two test cases

  1. If a single page contains two subsection. It picks the top section and print it in the header.Due to this the next page contains subsection of the previous page in the header.

2.If a page doesn't contain any subsection. It prints subsection of the previous page in the header.

@ashkulz
Copy link
Member

ashkulz commented Apr 13, 2015

Looks like a duplicate of #1654 -- please do not open new issues every time, but reopen the existing issue (#2292).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants