mikehaertl / phpwkhtmltopdf

A slim PHP wrapper around wkhtmltopdf with an easy to use and clean OOP interface
MIT License
1.6k stars 238 forks source link

My Header disappear second time when i generate pdf of same html page. #345

Closed sunilsharma0 closed 4 years ago

sunilsharma0 commented 4 years ago

I don't know why this is happening with me. I set my default header and footer. But sometimes header comes but footer comes every time. My Header disappear second time when i generate pdf of same html page. Please help me anyone @mikehaertl @jgornick @luissquall @igorw @Syrok @tomfotherby

mikehaertl commented 4 years ago

I have no idea either. To fix something we would at least need a minimal (!) code example to always (!!) reproduce the problem. So I'm closing this for now.

sunilsharma0 commented 4 years ago

$pdf = new mikepdf(['margin-left' => 0,'margin-right' => 0, 'binary'=>env('wkhtmltopdf_path','/usr/local/bin/wkhtmltopdf')]); $pdf->setOptions([ 'enable-external-links' ]); $pdf->addPage(view('report.header',$this->data())->render()); $pdf->addPage(view('report.header',$this->data())->render()); $pdf->addPage(view('report.header',$this->data())->render()); $pdf->addPage(view('report.header',$this->data())->render()); $header_footer = [ 'header-html' => new mikeFile(view('report.header',$this->data())->render(),'.html'), 'footer-html' => view('report.footer',$this->data())->render() ]; $pdf->saveAs(public_path('reports/report_file.pdf')); @mikehaertl @jgornick