dompdf Numbering pages but skip first one












5















I use dompdf class and I need page numembering for every page



I did this and it works:



$dompdf = new Dompdf();
$dompdf->load_html($html);
$dompdf->render();

$canvas = $dompdf->get_canvas();
$font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

$canvas->page_text(72, 18, "Header: {PAGE_NUM}", $font, 6, array(0,0,0));


What I need is just skip first page and start numbering from second page.



How can I do this?










share|improve this question



























    5















    I use dompdf class and I need page numembering for every page



    I did this and it works:



    $dompdf = new Dompdf();
    $dompdf->load_html($html);
    $dompdf->render();

    $canvas = $dompdf->get_canvas();
    $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

    $canvas->page_text(72, 18, "Header: {PAGE_NUM}", $font, 6, array(0,0,0));


    What I need is just skip first page and start numbering from second page.



    How can I do this?










    share|improve this question

























      5












      5








      5


      1






      I use dompdf class and I need page numembering for every page



      I did this and it works:



      $dompdf = new Dompdf();
      $dompdf->load_html($html);
      $dompdf->render();

      $canvas = $dompdf->get_canvas();
      $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

      $canvas->page_text(72, 18, "Header: {PAGE_NUM}", $font, 6, array(0,0,0));


      What I need is just skip first page and start numbering from second page.



      How can I do this?










      share|improve this question














      I use dompdf class and I need page numembering for every page



      I did this and it works:



      $dompdf = new Dompdf();
      $dompdf->load_html($html);
      $dompdf->render();

      $canvas = $dompdf->get_canvas();
      $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

      $canvas->page_text(72, 18, "Header: {PAGE_NUM}", $font, 6, array(0,0,0));


      What I need is just skip first page and start numbering from second page.



      How can I do this?







      php dompdf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 22 '18 at 13:21









      OTAROTAR

      9,5883491163




      9,5883491163
























          4 Answers
          4






          active

          oldest

          votes


















          1





          +50









          Here is what worked for me:



          $dompdf = new Dompdf();
          $dompdf->load_html($html);
          $dompdf->render();

          $canvas = $dompdf->get_canvas();
          $cpdf = $canvas->get_cpdf();

          $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

          $firstPageId = $cpdf->getFirstPageId();
          $objects = $cpdf->objects;
          $pages = array_filter($objects, function($v) {
          return $v['t'] == 'page';
          });
          $number = 1;
          foreach($pages as $pageId => $page) {
          if(($pageId + 1) !== $firstPageId) {
          $canvas->reopen_object($pageId + 1);
          $canvas->text(72, 18, "Header: $number", $font, 6, array(0,0,0));
          $canvas->close_object();
          $number++;
          }
          }

          $dompdf->stream();


          How this works:




          1. Get all the pages from https://github.com/dompdf/dompdf/blob/v0.8.2/lib/Cpdf.php#L32

          2. Add the text to all except the 1st page.






          share|improve this answer
























          • Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

            – OTAR
            Dec 3 '18 at 15:26













          • Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

            – Jannes Botis
            Dec 3 '18 at 15:32













          • - I will try tomorrow at work. Thank You very much !

            – OTAR
            Dec 3 '18 at 16:03













          • Color me impressed.

            – BrianS
            Dec 29 '18 at 3:51



















          0














          try the following in dompdf 0.6.2 or earlier:



          $dompdf->render();
          $canvas = $dompdf->get_canvas();
          $canvas->page_script('
          if ($PAGE_NUM > 1) {
          $font = Font_Metrics::get_font("helvetica", "bold");
          $current_page = $PAGE_NUM-1;
          $total_pages = $PAGE_COUNT-1;
          $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
          }
          ');


          Things are a bit different starting with dompdf 0.7.0:



          $dompdf->render();
          $canvas = $dompdf->getCanvas();
          $canvas->page_script('
          if ($PAGE_NUM > 1) {
          $font = $fontMetrics->getFont("helvetica", "bold");
          $current_page = $PAGE_NUM-1;
          $total_pages = $PAGE_COUNT-1;
          $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
          }
          ');





          share|improve this answer
























          • Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

            – OTAR
            Nov 26 '18 at 5:22











          • "not works" means, not prints anything

            – OTAR
            Nov 26 '18 at 5:25













          • This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

            – BrianS
            Dec 29 '18 at 3:53





















          0














          Have not worked with DOMPDF before but came across a pure CSS solution in this GitHub DOMPDF Post and prepared a small example, perhaps you will find it helpful.






          body {
          counter-reset: page;
          }

          .footer:not(:first-child) .page-number:before {
          counter-increment: page;
          color: red;
          content: 'Page ';
          }

          .footer:not(:first-child) .page-number:after {
          color: red;
          content: counter(page);
          }

          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 0</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 1</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 2</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 3</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 4</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 5</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 6</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 7</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 8</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 9</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 10</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 11</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 12</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 13</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>
          <hr>
          <div class="footer fixed-section">
          <div class="left">
          <span class="report-time">08/05/2016 09:43:06</span><br>
          <span class="promo">Generated by ...</span>
          </div>
          <div class="center">
          <span class="signature-warning">This is page 14</span>
          </div>
          <div class="right">
          <span class="page-number"></span>
          </div>
          </div>








          share|improve this answer

































            0














            from this link
            you can use function like below



            // set page number on the left side
            $pdf->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);





            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431942%2fdompdf-numbering-pages-but-skip-first-one%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              4 Answers
              4






              active

              oldest

              votes








              4 Answers
              4






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1





              +50









              Here is what worked for me:



              $dompdf = new Dompdf();
              $dompdf->load_html($html);
              $dompdf->render();

              $canvas = $dompdf->get_canvas();
              $cpdf = $canvas->get_cpdf();

              $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

              $firstPageId = $cpdf->getFirstPageId();
              $objects = $cpdf->objects;
              $pages = array_filter($objects, function($v) {
              return $v['t'] == 'page';
              });
              $number = 1;
              foreach($pages as $pageId => $page) {
              if(($pageId + 1) !== $firstPageId) {
              $canvas->reopen_object($pageId + 1);
              $canvas->text(72, 18, "Header: $number", $font, 6, array(0,0,0));
              $canvas->close_object();
              $number++;
              }
              }

              $dompdf->stream();


              How this works:




              1. Get all the pages from https://github.com/dompdf/dompdf/blob/v0.8.2/lib/Cpdf.php#L32

              2. Add the text to all except the 1st page.






              share|improve this answer
























              • Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

                – OTAR
                Dec 3 '18 at 15:26













              • Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

                – Jannes Botis
                Dec 3 '18 at 15:32













              • - I will try tomorrow at work. Thank You very much !

                – OTAR
                Dec 3 '18 at 16:03













              • Color me impressed.

                – BrianS
                Dec 29 '18 at 3:51
















              1





              +50









              Here is what worked for me:



              $dompdf = new Dompdf();
              $dompdf->load_html($html);
              $dompdf->render();

              $canvas = $dompdf->get_canvas();
              $cpdf = $canvas->get_cpdf();

              $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

              $firstPageId = $cpdf->getFirstPageId();
              $objects = $cpdf->objects;
              $pages = array_filter($objects, function($v) {
              return $v['t'] == 'page';
              });
              $number = 1;
              foreach($pages as $pageId => $page) {
              if(($pageId + 1) !== $firstPageId) {
              $canvas->reopen_object($pageId + 1);
              $canvas->text(72, 18, "Header: $number", $font, 6, array(0,0,0));
              $canvas->close_object();
              $number++;
              }
              }

              $dompdf->stream();


              How this works:




              1. Get all the pages from https://github.com/dompdf/dompdf/blob/v0.8.2/lib/Cpdf.php#L32

              2. Add the text to all except the 1st page.






              share|improve this answer
























              • Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

                – OTAR
                Dec 3 '18 at 15:26













              • Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

                – Jannes Botis
                Dec 3 '18 at 15:32













              • - I will try tomorrow at work. Thank You very much !

                – OTAR
                Dec 3 '18 at 16:03













              • Color me impressed.

                – BrianS
                Dec 29 '18 at 3:51














              1





              +50







              1





              +50



              1




              +50





              Here is what worked for me:



              $dompdf = new Dompdf();
              $dompdf->load_html($html);
              $dompdf->render();

              $canvas = $dompdf->get_canvas();
              $cpdf = $canvas->get_cpdf();

              $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

              $firstPageId = $cpdf->getFirstPageId();
              $objects = $cpdf->objects;
              $pages = array_filter($objects, function($v) {
              return $v['t'] == 'page';
              });
              $number = 1;
              foreach($pages as $pageId => $page) {
              if(($pageId + 1) !== $firstPageId) {
              $canvas->reopen_object($pageId + 1);
              $canvas->text(72, 18, "Header: $number", $font, 6, array(0,0,0));
              $canvas->close_object();
              $number++;
              }
              }

              $dompdf->stream();


              How this works:




              1. Get all the pages from https://github.com/dompdf/dompdf/blob/v0.8.2/lib/Cpdf.php#L32

              2. Add the text to all except the 1st page.






              share|improve this answer













              Here is what worked for me:



              $dompdf = new Dompdf();
              $dompdf->load_html($html);
              $dompdf->render();

              $canvas = $dompdf->get_canvas();
              $cpdf = $canvas->get_cpdf();

              $font = $dompdf->getFontMetrics()->get_font("helvetica", "bold");

              $firstPageId = $cpdf->getFirstPageId();
              $objects = $cpdf->objects;
              $pages = array_filter($objects, function($v) {
              return $v['t'] == 'page';
              });
              $number = 1;
              foreach($pages as $pageId => $page) {
              if(($pageId + 1) !== $firstPageId) {
              $canvas->reopen_object($pageId + 1);
              $canvas->text(72, 18, "Header: $number", $font, 6, array(0,0,0));
              $canvas->close_object();
              $number++;
              }
              }

              $dompdf->stream();


              How this works:




              1. Get all the pages from https://github.com/dompdf/dompdf/blob/v0.8.2/lib/Cpdf.php#L32

              2. Add the text to all except the 1st page.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Dec 2 '18 at 16:06









              Jannes BotisJannes Botis

              6,53421124




              6,53421124













              • Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

                – OTAR
                Dec 3 '18 at 15:26













              • Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

                – Jannes Botis
                Dec 3 '18 at 15:32













              • - I will try tomorrow at work. Thank You very much !

                – OTAR
                Dec 3 '18 at 16:03













              • Color me impressed.

                – BrianS
                Dec 29 '18 at 3:51



















              • Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

                – OTAR
                Dec 3 '18 at 15:26













              • Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

                – Jannes Botis
                Dec 3 '18 at 15:32













              • - I will try tomorrow at work. Thank You very much !

                – OTAR
                Dec 3 '18 at 16:03













              • Color me impressed.

                – BrianS
                Dec 29 '18 at 3:51

















              Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

              – OTAR
              Dec 3 '18 at 15:26







              Thanks, it works, one side question please, how can change font size? I tried: $font = $dompdf->getFontMetrics()->get_font("helvetica", "24"); but this not works

              – OTAR
              Dec 3 '18 at 15:26















              Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

              – Jannes Botis
              Dec 3 '18 at 15:32







              Try $canvas->text(72, 18, "Header: $number", $font, 24, array(0,0,0)); github.com/dompdf/dompdf/blob/…

              – Jannes Botis
              Dec 3 '18 at 15:32















              - I will try tomorrow at work. Thank You very much !

              – OTAR
              Dec 3 '18 at 16:03







              - I will try tomorrow at work. Thank You very much !

              – OTAR
              Dec 3 '18 at 16:03















              Color me impressed.

              – BrianS
              Dec 29 '18 at 3:51





              Color me impressed.

              – BrianS
              Dec 29 '18 at 3:51













              0














              try the following in dompdf 0.6.2 or earlier:



              $dompdf->render();
              $canvas = $dompdf->get_canvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = Font_Metrics::get_font("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');


              Things are a bit different starting with dompdf 0.7.0:



              $dompdf->render();
              $canvas = $dompdf->getCanvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = $fontMetrics->getFont("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');





              share|improve this answer
























              • Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

                – OTAR
                Nov 26 '18 at 5:22











              • "not works" means, not prints anything

                – OTAR
                Nov 26 '18 at 5:25













              • This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

                – BrianS
                Dec 29 '18 at 3:53


















              0














              try the following in dompdf 0.6.2 or earlier:



              $dompdf->render();
              $canvas = $dompdf->get_canvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = Font_Metrics::get_font("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');


              Things are a bit different starting with dompdf 0.7.0:



              $dompdf->render();
              $canvas = $dompdf->getCanvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = $fontMetrics->getFont("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');





              share|improve this answer
























              • Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

                – OTAR
                Nov 26 '18 at 5:22











              • "not works" means, not prints anything

                – OTAR
                Nov 26 '18 at 5:25













              • This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

                – BrianS
                Dec 29 '18 at 3:53
















              0












              0








              0







              try the following in dompdf 0.6.2 or earlier:



              $dompdf->render();
              $canvas = $dompdf->get_canvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = Font_Metrics::get_font("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');


              Things are a bit different starting with dompdf 0.7.0:



              $dompdf->render();
              $canvas = $dompdf->getCanvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = $fontMetrics->getFont("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');





              share|improve this answer













              try the following in dompdf 0.6.2 or earlier:



              $dompdf->render();
              $canvas = $dompdf->get_canvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = Font_Metrics::get_font("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');


              Things are a bit different starting with dompdf 0.7.0:



              $dompdf->render();
              $canvas = $dompdf->getCanvas();
              $canvas->page_script('
              if ($PAGE_NUM > 1) {
              $font = $fontMetrics->getFont("helvetica", "bold");
              $current_page = $PAGE_NUM-1;
              $total_pages = $PAGE_COUNT-1;
              $pdf->text(522, 770, "Page: $current_page of $total_pages", $font, 10, array(0,0,0));
              }
              ');






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 22 '18 at 13:30









              Madhuri PatelMadhuri Patel

              841517




              841517













              • Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

                – OTAR
                Nov 26 '18 at 5:22











              • "not works" means, not prints anything

                – OTAR
                Nov 26 '18 at 5:25













              • This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

                – BrianS
                Dec 29 '18 at 3:53





















              • Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

                – OTAR
                Nov 26 '18 at 5:22











              • "not works" means, not prints anything

                – OTAR
                Nov 26 '18 at 5:25













              • This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

                – BrianS
                Dec 29 '18 at 3:53



















              Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

              – OTAR
              Nov 26 '18 at 5:22





              Thanks but I already tried this, found here: stackoverflow.com/questions/35491339/… but this not works

              – OTAR
              Nov 26 '18 at 5:22













              "not works" means, not prints anything

              – OTAR
              Nov 26 '18 at 5:25







              "not works" means, not prints anything

              – OTAR
              Nov 26 '18 at 5:25















              This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

              – BrianS
              Dec 29 '18 at 3:53







              This method should work, did you enable embedded script support (with release 0.7.0+ add $dompdf->set_option('isPhpEnabled', true))? If not then Dompdf would ignore the page script.

              – BrianS
              Dec 29 '18 at 3:53













              0














              Have not worked with DOMPDF before but came across a pure CSS solution in this GitHub DOMPDF Post and prepared a small example, perhaps you will find it helpful.






              body {
              counter-reset: page;
              }

              .footer:not(:first-child) .page-number:before {
              counter-increment: page;
              color: red;
              content: 'Page ';
              }

              .footer:not(:first-child) .page-number:after {
              color: red;
              content: counter(page);
              }

              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 0</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 1</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 2</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 3</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 4</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 5</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 6</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 7</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 8</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 9</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 10</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 11</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 12</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 13</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>
              <hr>
              <div class="footer fixed-section">
              <div class="left">
              <span class="report-time">08/05/2016 09:43:06</span><br>
              <span class="promo">Generated by ...</span>
              </div>
              <div class="center">
              <span class="signature-warning">This is page 14</span>
              </div>
              <div class="right">
              <span class="page-number"></span>
              </div>
              </div>








              share|improve this answer






























                0














                Have not worked with DOMPDF before but came across a pure CSS solution in this GitHub DOMPDF Post and prepared a small example, perhaps you will find it helpful.






                body {
                counter-reset: page;
                }

                .footer:not(:first-child) .page-number:before {
                counter-increment: page;
                color: red;
                content: 'Page ';
                }

                .footer:not(:first-child) .page-number:after {
                color: red;
                content: counter(page);
                }

                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 0</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 1</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 2</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 3</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 4</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 5</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 6</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 7</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 8</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 9</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 10</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 11</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 12</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 13</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>
                <hr>
                <div class="footer fixed-section">
                <div class="left">
                <span class="report-time">08/05/2016 09:43:06</span><br>
                <span class="promo">Generated by ...</span>
                </div>
                <div class="center">
                <span class="signature-warning">This is page 14</span>
                </div>
                <div class="right">
                <span class="page-number"></span>
                </div>
                </div>








                share|improve this answer




























                  0












                  0








                  0







                  Have not worked with DOMPDF before but came across a pure CSS solution in this GitHub DOMPDF Post and prepared a small example, perhaps you will find it helpful.






                  body {
                  counter-reset: page;
                  }

                  .footer:not(:first-child) .page-number:before {
                  counter-increment: page;
                  color: red;
                  content: 'Page ';
                  }

                  .footer:not(:first-child) .page-number:after {
                  color: red;
                  content: counter(page);
                  }

                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 0</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 1</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 2</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 3</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 4</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 5</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 6</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 7</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 8</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 9</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 10</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 11</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 12</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 13</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 14</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>








                  share|improve this answer















                  Have not worked with DOMPDF before but came across a pure CSS solution in this GitHub DOMPDF Post and prepared a small example, perhaps you will find it helpful.






                  body {
                  counter-reset: page;
                  }

                  .footer:not(:first-child) .page-number:before {
                  counter-increment: page;
                  color: red;
                  content: 'Page ';
                  }

                  .footer:not(:first-child) .page-number:after {
                  color: red;
                  content: counter(page);
                  }

                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 0</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 1</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 2</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 3</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 4</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 5</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 6</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 7</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 8</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 9</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 10</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 11</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 12</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 13</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 14</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>








                  body {
                  counter-reset: page;
                  }

                  .footer:not(:first-child) .page-number:before {
                  counter-increment: page;
                  color: red;
                  content: 'Page ';
                  }

                  .footer:not(:first-child) .page-number:after {
                  color: red;
                  content: counter(page);
                  }

                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 0</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 1</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 2</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 3</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 4</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 5</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 6</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 7</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 8</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 9</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 10</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 11</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 12</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 13</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 14</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>





                  body {
                  counter-reset: page;
                  }

                  .footer:not(:first-child) .page-number:before {
                  counter-increment: page;
                  color: red;
                  content: 'Page ';
                  }

                  .footer:not(:first-child) .page-number:after {
                  color: red;
                  content: counter(page);
                  }

                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 0</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 1</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 2</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 3</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 4</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 5</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 6</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 7</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 8</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 9</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 10</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 11</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 12</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 13</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>
                  <hr>
                  <div class="footer fixed-section">
                  <div class="left">
                  <span class="report-time">08/05/2016 09:43:06</span><br>
                  <span class="promo">Generated by ...</span>
                  </div>
                  <div class="center">
                  <span class="signature-warning">This is page 14</span>
                  </div>
                  <div class="right">
                  <span class="page-number"></span>
                  </div>
                  </div>






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 30 '18 at 19:48

























                  answered Nov 30 '18 at 19:43









                  Peter DarmisPeter Darmis

                  5,69811225




                  5,69811225























                      0














                      from this link
                      you can use function like below



                      // set page number on the left side
                      $pdf->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);





                      share|improve this answer




























                        0














                        from this link
                        you can use function like below



                        // set page number on the left side
                        $pdf->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);





                        share|improve this answer


























                          0












                          0








                          0







                          from this link
                          you can use function like below



                          // set page number on the left side
                          $pdf->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);





                          share|improve this answer













                          from this link
                          you can use function like below



                          // set page number on the left side
                          $pdf->page_text(16, $y, "Page: {PAGE_NUM} of {PAGE_COUNT}", $font, 8, $color);






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 1 '18 at 12:09









                          Ali GhalambazAli Ghalambaz

                          11814




                          11814






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431942%2fdompdf-numbering-pages-but-skip-first-one%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Costa Masnaga

                              Fotorealismo

                              Sidney Franklin