I am using Laravel DOMPDF everything is working fine except i want to show page no on every page also which is not showing as of now.
My Controller:
public function generatePDF()
{
try
{
$id = hexdec($_GET['id']);
$data = DB::table('table_name')
->where('id','=',$id)
->get();
$pdf = PDF::loadView('pages.myPDF', compact('data'));
return $pdf->download($caseName.'.pdf');
}
catch(\Exception $ex)
{
return $ex->getMessage();
}
}
My View File:
<html>
<head>
</head>
<style type="text/css" media="all">
@page {
header: page-header;
footer: page-footer;
}
@page{
header:page-header;
margin-top:105t;
}
.w3-Times-New-Roman {
font-family: "Lobster", serif;
}
</style>
<body>
<script>
if ( isset($pdf) ) {
$font = Font_Metrics::get_font("helvetica", "bold");
$pdf->page_text(72, 18, "Header: {PAGE_NUM} of {PAGE_COUNT}", $font, 6, array(0,0,0));
}
</script>
<div style="font-family: Times New Roman; font-size: 12px;word-spacing: 3px; text-align: justify; color:#000;"> <?php
$array1 = array("<blockquote>\r\n<p>","</p>\r\n</blockquote>");
$array2 = array("<blockquote>","</blockquote>");
$array3 = array("<i><u>","</u></i>");
$value = str_replace($array1, $array3, $data[0]->columnName);
$value = str_replace($array2, $array3, $value);
?>
{!!$value!!}
</div><br>
</body>
</html>
But this is not generating no on every page in PDF. Please help me how can i achieve that.