简体   繁体   English

如何解决 Dompdf-Laravel 2.0.0 总页码不起作用的问题?

[英]How can I solve Dompdf-Laravel 2.0.0 total page number not working?

I have used this code in laravel blade file:我在 laravel 刀片文件中使用了这段代码:

<script type="text/php">
    if (isset($pdf)) {
      $pdf->page_script('
        $text = "Page {PAGE_NUM} of {PAGE_COUNT}";
        $size = 12;
        $color = array(0,0,0);
        $word_space = 0.0;  //  default
        $char_space = 0.0;  //  default
        $angle = 0.0;   //  default
        $font = $fontMetrics->getFont("Verdana");
        $width = $fontMetrics->get_text_width($text, $font, $size) / 2;
        $x = ($pdf->get_width() - $width) / 2;
        $y = $pdf->get_height() - 20;
        $pdf->page_text($x, $y, $text, $font, $size, $color, $word_space, $char_space, $angle);
      ');
    }
  </script>

But Total page number always gets 1 instead of total number of pages in Laravel dompdf and only print the first page.但是总页数总是得到 1 而不是 Laravel dompdf 中的总页数并且只打印第一页。 I am using barryvdh/laravel-dompdf:v2.0.0.我正在使用 barryvdh/laravel-dompdf:v2.0.0。 How can I solve this?我该如何解决这个问题?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM