paranoid
paranoid

Reputation: 7105

Laravel 5 PDF footers with blade show blank

I use "barryvdh/laravel-snappy": "^0.4.0"

for export pdf.

I want to add footer on my pdf file but when I add footer-html on my code show me blank pdf file.

public function exportPdf($id)
{
     $pdf = PDF::loadView('TestView::pdf', [my_array]);
     $pdf->setOption('footer-html', View('TestView::pdf_footer'));
     $pdf->setOrientation('landscape');
     $pdf->setPaper('a6');
}

And when I comment this code $pdf->setOption('footer-html', View('TestView::pdf_footer')); show me correct export pdf file.

TestView::pdf_footer content:

<footer class="footer">
     <div class="u-pattern"></div>
     <div class="u-back-green"></div>
</footer>

Upvotes: 2

Views: 1659

Answers (1)

Remul
Remul

Reputation: 8242

Your Footer needs to be a complete HTML file, otherwise wkhtmltopdf will not render it correctly.

<!DOCTYPE html>
<html>
<head></head>
<body>
    <footer class="footer">
        <div class="u-pattern"></div>
        <div class="u-back-green"></div>
    </footer>
</body>
</html>

Upvotes: 3

Related Questions