0
For PDF versions of our Invoice we are required to place particular information at the top (or bottom) of each invoice page. While Logo is not one of these items (we must place company registration number), it would be useful to have the logo and address information at the top of each page too.
I understand that IM uses dompdf and a quick search shows that dompdf supports headers, footers, etc on each page as well as many other nice features. Thus I assume that I can include inline php code into the template IM provides? Is my assumption correct? Have you done this before? Can you provide any pointers or sample templates on using inline php to leverage the dompdf library.
Thanks
I understand that IM uses dompdf and a quick search shows that dompdf supports headers, footers, etc on each page as well as many other nice features. Thus I assume that I can include inline php code into the template IM provides? Is my assumption correct? Have you done this before? Can you provide any pointers or sample templates on using inline php to leverage the dompdf library.
Thanks
Responses (4)
-
Accepted Answer
-
Accepted Answer
0Hi Germinal,
I was looking for the same functionality and found this one which pointed me in the right direction.
I'v tried several things but could not get the static footer to be displayed on the PDF's.
I saw that on line 83, the html template is being loaded.
A bit before, starting at line 70, the page is build. On line 80, you have the end tags .
I thought that if I would add following code on line 80, I would be home free:
However this did not bring any joy. The text does not appear at all when a PDF is being generated.
When I add this code to the HTML code in the template, the footer appears at the bottom of the existing text, which can be in the middle of the second page. It would be great to actually be able to see the static footer text at the real footer location.
Do you know if I'm looking in the right direction or am I completely wrong ?
Thanks,
Mario -
Accepted Answer
0no, that's not it. we were talking about a footer built directly into the DOMpdf engine (not in the HTML code, which is what you tried to do)
there they explain somethings about it, but it's a bit complicated: https://code.google.com/p/dompdf/wiki/faq -
Accepted Answer
0Hi Germinal,
That was a good tip ! It was even more simple that I thought.
I did not change anything in the DOMpdf related files. My changes went directly into the template code.
The result is a footer (was not interested in a header so did not implement that code) with static text and page numbering.
Maybe more people are interested in how to do this: this is the code I added to the template...
Within the style tag:
Immediately after the closing head tag:
One thing I have not figured out yet is the total count of pages. I'd like the page numbering to say "Page x of y".
If anyone has a clue what this might be...
(Sorry for not copying the code as plain text - I have some bad results on this system so had to revert to using screenshots)
Thanks,
Mario
Your Reply

Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »