This is an archived forum post. The information may be outdated. Contact us if you have any
Header exclude page options
wrote on 2016-07-08:
My client would like to have the header only show on select pages in the PDF. I understand we can exclude the pages in the API, but that API function refers to the outputted PDF page #'s right? We wouldn't have any way of knowing those page numbers at run time as they are very unlikely to match up exactly as the content pages we are pushing to it. Make sense? Am I missing something? How would we go about having it only on page 1?
So then I was thinking we could just not use the header function and put drop in our own header right in the content where needed. The problem then though is that the top margin would be the same for both the header on the first page and the content on the 2nd page, instead of the content starting at the same point consistently. Maybe it would work to have a big top-margin and use negative margins on the header html we inject?
Any other thoughts or ideas?
wrote on 2016-07-14:
wrote on 2016-07-18:
You are right, there is no way of knowing page numbers at runtime. Also, it is not currently possible to have a header only on the first page.
As for having the header in the content, it could work with the page-break-before or page-break-after css rules. An example:
<div class="header" style="height:200px">
Header on the first page
Page 1 content
<div style="page-break-before:always;height:200px"> </div>
Page 2 content
wrote on 2016-07-31:
Thanks for your help. I don't think the inserting HTML in the content is going to work very well given that many pages in the content will be taller than one page height so the top margin would be inconsistent. I'll experiment a bit with a negative margin and/or absolute positioning for the header to see if can mimic that behaviour.