getting a page footer in a pdf?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamie
    Senior Member
    • Aug 2025
    • 215

    #1

    getting a page footer in a pdf?

    i'm trying to get a dynamic page footer on every page, though finding it extremely difficult has anyone found a clean way todo this?
  • emillod
    Active Community Member
    • Apr 2017
    • 1559

    #2
    Hello,
    don't sure what do you mean, but there is a footer section on each template settings. You just have to click on Print Footer.
    Click image for larger version

Name:	image.png
Views:	0
Size:	18.5 KB
ID:	124065

    Comment

    • jamie
      Senior Member
      • Aug 2025
      • 215

      #3
      Originally posted by emillod
      Hello,
      don't sure what do you mean, but there is a footer section on each template settings. You just have to click on Print Footer.
      Click image for larger version

Name:	image.png
Views:	0
Size:	18.5 KB
ID:	124065
      That's a static footer, not a dynamic one, i need to access variables set when the pdf is renderd

      Comment

      • emillod
        Active Community Member
        • Apr 2017
        • 1559

        #4
        I'm not sure what kind of variables, but alternative is that you can code a template helper.

        Comment

        • rabii
          Active Community Member
          • Jun 2016
          • 1368

          #5
          Originally posted by jamie
          i'm trying to get a dynamic page footer on every page, though finding it extremely difficult has anyone found a clean way todo this?
          i think it is the same as the body you can access entity data in footer too.
          Rabii
          EspoCRM & Web Dev

          🔗 See what I’ve built for EspoCRM

          Comment

          • jamie
            Senior Member
            • Aug 2025
            • 215

            #6
            no i couldn't access any varibles from the main body and ended up doing a template helper that had its own power but also wiredness, this dompdf needs to die <3

            Comment

            • yuri
              EspoCRM product developer
              • Mar 2014
              • 9592

              #7
              Dompdf is a great library. It's not a simple task to render PDFs. The fact that it renders HTML pretty good while being open sourced and not requirng any 3rd party software, we should show gratitude to the developers.
              If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

              Comment

              • jamie
                Senior Member
                • Aug 2025
                • 215

                #8
                Originally posted by yuri
                Dompdf is a great library. It's not a simple task to render PDFs. The fact that it renders HTML pretty well while being open-sourced and not requiring any 3rd party software, we should show gratitude to the developers.
                i did it with a <3, so yeah, I appreciate development time,

                Though it's proving to be an absolute nightmare to get a dynamic footer and page numbers, prhaps its just your implementation of it that makes it so hard to work with. i had to edit the vendor options to turn on certain functions to almost get the page numbers working, as it wouldn't do it via the normal CSS route

                would be great to have an libarary that supports css 3 and html 5 nativaly

                Comment


                • yuri
                  yuri commented
                  Editing a comment
                  This is for those who read this in the future. There's nothing difficult, no problems with conditional logic in the footer. Everything works. Page numbers does work. The total number of pages is not supported.

                  https://forum.espocrm.com/forum/deve...097#post124097

                  Overly emotional language with 'absolute nightmare' etc, is what I always ask to abstain to use, especially on the forum where one expects others to help. It's toxic. I will be removing posts with such language in the future.
              • yuri
                EspoCRM product developer
                • Mar 2014
                • 9592

                #9
                Absolute complete catastrophe.
                If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                Comment

                • jamie
                  Senior Member
                  • Aug 2025
                  • 215

                  #10
                  Originally posted by yuri
                  Absolute complete catastrophe.
                  yeah its just not being a helpful libary and even ChatGPT is sympathetic to my plite saying this page numbering is a very common problem of dompdf

                  Comment

                  • jamie
                    Senior Member
                    • Aug 2025
                    • 215

                    #11
                    Originally posted by yuri
                    Absolute complete catastrophe.
                    i am using this inside a template helper, and it puts page numbering on all pages above 2 but not on the first one

                    <script type="text/php">
                    if (isset($pdf)) {
                    $font = $fontMetrics->get_font("Open Sans", "normal");
                    $x = 560;
                    $y = 825;
                    $text = "{PAGE_NUM} / {PAGE_COUNT}";
                    $pdf->page_text($x, $y, $text, $font, 6, [0,0,0]);
                    }
                    </script>

                    Comment

                    • yuri
                      EspoCRM product developer
                      • Mar 2014
                      • 9592

                      #12
                      I looked into it years ago. I remember the limitation with total page numbers, it was not implemented back then, I think it's still valid. It's quite a small downside. What is dynamic footer, I think neither me nor others are fully sure there understood.
                      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                      Comment


                      • yuri
                        yuri commented
                        Editing a comment
                        I just checked, an entity placeholder like {fieldName}} is printed in the footer.
                    • jamie
                      Senior Member
                      • Aug 2025
                      • 215

                      #13
                      Originally posted by yuri
                      I looked into it years ago. I remember the limitation with total page numbers; it was not implemented back then, but I think it's still valid. It's quite a small downside. What is a dynamic footer? I think neither I nor others are fully sure there understood.
                      Page numbers are kind of important for larger documents, as once you print them out, you don't know the order or if you have all of them

                      i mean that it changes based on variables, so we have 2 different companies we send out invoices from and i need to change the footer to reflect the company, that i am doing just fine via a template helper, though i can't get it on every page, but that isn't as important as the page numbering

                      i tried doing page numbering via espo footer and it wasn't able to display the total number of pages and i couldn't use variables in it either

                      Comment

                      • yuri
                        EspoCRM product developer
                        • Mar 2014
                        • 9592

                        #14
                        > i couldn't use variables in it either

                        What are variables. Placeholders? They work fine for me. Placeholders are printed in the footer on the second page.


                        Click image for larger version  Name:	image.png Views:	0 Size:	21.3 KB ID:	124094
                        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                        Comment

                        • ThomasB
                          Senior Member
                          • Mar 2022
                          • 181

                          #15
                          Here is the discussion about it: https://github.com/dompdf/dompdf/iss...ment-740015376

                          Not sure if the workaround still works or how to use it.

                          There are not many free PHP PDF libaries around.TCPDF is in maintance mode and has only a few new commits. There is a successor available called tc-lib-pdf.
                          But it has only a stable release recently. It's still work in progress and I don't know if its on par with tcpdf yet and what are the advantages or disadvantages of the new version.

                          Comment

                          Working...