Repeat header in print

3

I can not divulge the report I'm using, so I've taken a generic template on google to help me explain the question.

Assuming my report is as follows:

ThesameismountedviaHTMLonasystemthatworkswithbothC#andVB.Net.Myintentionisoneachprintpage,keepthefollowingheader:

This header is an image in the HTML body, in fact, the entire report is simply made with HTML and CSS the database of the data it receives from the database, ie no component is being used such as Crystal Reports .

How can I maintain this header on each print page?

    
asked by anonymous 13.05.2015 / 19:35

2 answers

4

You can not do this without the help of a tool. The HTML Renderer for PdfSharp is an envelope for PdfSharp, and PdfSharp has the footer and footer feature. / p>

If all else fails, you still can Pure PdfSharp

    
13.05.2015 / 20:06
3

Nothing much beyond my comment, and with little Browsers support (today it works in Firefox and IE (do not know if at all)), you could put your content inside a table and add the title (or header) that you want to repeat within the <thead> element, this would cause the headers to repeat at each page at the time of printing (in the browsers quoted). Something similar to this:

<table>    
  <thead>
     <!-- Will print at the top of every page -->
  </thead>    
  <tbody>
     <!-- Page content -->
  </tbody>   
</table>

But as you mentioned there are already other tables on your page, then you could just apply the table style to your elements, something like this:

CSS:

@media print {
    #header {
        display: table-header-group;
    }

    #content {
        display: table-row-group;
    }
}

HTML:

<div id="header">
    Cabeçalhos
</div>
<div id="content">
    ... conteúdo das paginas
</div>

Source: Print header / footer on all pages (Print Mode) - SOen

    
13.05.2015 / 20:33