Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 647

html to pdf with chrome PrintToPdf in document style, with header and footer

$
0
0

I've a simple html document, with header, main Area and footer. The main Area contains content like Text and Tables.I would like to print the document only with html and css to pdf. The header and footer are in fixed position.The problem is that the content always overwrite the footer. I cant make it happen, that the content only goes to the footer, and then i get a page break, that the content continues on the next pdf under the header.Can someone tell me how i can do this? Javascript is ok to, but I don't see any point in this yet.I can't use tools like jspdf or weasyprint or something else.

Can't media print do this automatically?

First i built the document with grid css. This works very well, the only problem i had, was, that i need know how big the content of the main area was to attach a knew grid with the content which did not fit into the area on the first pdf.

But when i need the option of varying font size, this concept does not work.

I the case of the grid-version I need a process, that automatically calculate the size of the content depending on the font size. It's ok, too. But I think that this way to complicated. I create the document in c# from a database into html via stringbuilder and htmlagility pack.

The appearance in the browser is good. But I need to print it, too.

So it seems to be a small problem. Everything works fine, the only problem is overwriting the header and footer during automatic page breaks.

The current way I try to reach my goals is to use fixed header and footer. The pdf look good, and the forced page breaks works well. But the auto page break doesn't work will, here the footer an header always are overwritten by the content in in the maincontent area.

I cant post the code. stackoverflow does not allow me to post. I don't know why.


Viewing all articles
Browse latest Browse all 647

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>