Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HtmlRenderer & PDFsharp add footer to each page

I am trying to put a copyright symbol at the bottom of each page when the PDF is generated but I cant seem to get it to work. How would I go about doing such a thing? I am using HtmlRenderer and PDFsharp, take my HTML body and convert it to a PDF file that the user can download.

I don't want to put a watermark over the top as it is a legal document for paying customers, I just wanted the little copyright symbol company name and date at the bottom.

Is there a way of saying to PDFsharp to use a say template PDF file that has a footer with the info at the bottom or is there a way of setting it in the physical code?

like image 237
andy wilson Avatar asked Jan 19 '26 10:01

andy wilson


2 Answers

I Worked it out if you add styling position:fixed and then a top position because it doesnt understand bottom it will add a text to every page wherever you align it to.

like image 199
andy wilson Avatar answered Jan 21 '26 04:01

andy wilson


If anyone would like more information on this I've linked a pull request which details the use of position: fixed to create header/footers.

There is also a class in the generator itself PdfGenerateConfig which will allow you to create corresponding margins in the document.

https://github.com/ArthurHub/HTML-Renderer/pull/41

like image 38
dkaramazov Avatar answered Jan 21 '26 04:01

dkaramazov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!