Browse Source

fatture in cloud

Roberto Santini 3 weeks ago
parent
commit
40acc27232
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      resources/views/pdf/footer.blade.php

+ 8
- 4
resources/views/pdf/footer.blade.php View File

@@ -9,10 +9,14 @@
9 9
 if (isset($pdf)) {
10 10
     $font = $fontMetrics->get_font('DejaVu Sans', 'normal');
11 11
     $size = 8;
12
-    $label = {!! json_encode($documentoLabel.'  ') !!};
13
-    $text = $label . '{PAGE_NUM}/{PAGE_COUNT}';
14
-    $x = 40;
12
+    $color = array(0.35, 0.35, 0.35);
13
+    $label = {!! json_encode($documentoLabel, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) !!};
15 14
     $y = $pdf->get_height() - 28;
16
-    $pdf->page_text($x, $y, $text, $font, $size, array(0.35, 0.35, 0.35));
15
+    $pdf->page_text(40, $y, $label, $font, $size, $color);
16
+    $pdf->page_script(function (int $pageNumber, int $pageCount, $canvas, $metrics) use ($font, $size, $color, $y) {
17
+        $text = $pageNumber.'/'.$pageCount;
18
+        $width = $metrics->getTextWidth($text, $font, $size);
19
+        $canvas->text($canvas->get_width() - 40 - $width, $y, $text, $font, $size, $color);
20
+    });
17 21
 }
18 22
 </script>

Loading…
Cancel
Save