Laravel 5 domPDF PAGE_NUM and PAGE_COUNT -


i implemented success dompdf (barryvdh-dompdf wrapper laravel) in laravel 5 project.

the report rendering fine, unable add pdf report parameters (like in codeigniter): page_num, page_count, date , other stuff in header or footer of report.

do have solutions issue?

my code in laravel 5:

$data['company'] = company::find($company_id)->name; $dompdf = pdf::loadview('admin.inputs.report',$data)->setpaper('a4'); 

in codeigniter simple insert header:

$canvas = $this->dompdf->get_canvas(); $font = font_metrics::get_font("helvetica", "bold"); $canvas->page_text(36, 18, "page: {page_num} {page_count}", $font, 6, array(0,0,0)); return $dompdf->stream('invoice.pdf'); 

  1. enable php in dompdf (version: 0.6.*, dompdf)

change dompdf_enable_php true in dompdf.php config (file path: "...\vendor\barryvdh\laravel-dompdf\config").

  1. add lines pdf view:
<script type="text/php">  $text = 'page: {page_num} / {page_count}';  $font = font_metrics::get_font("helvetica", "bold");  $pdf->page_text(36, 18, $text, $font, 9); </script> 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -