首页 > 解决方案 > How to set custom header in elibyy/tcpdf-laravel

问题描述

I'm using this: https://github.com/elibyy/tcpdf-laravel. I need to setup multiline header strings and horizondal ruler. I have attached the images for reference.

Expected output

Actual output

PDF::setHeaderCallback(function ($pdf) use ($pdfname) {
    // Set font
    $pdf->SetFont('cid0jp', '', 10);
    // Title
    $pdf->Cell(0, 15, '', 0, false, 'C', 0, '', 0, false, 'M', 'M');
    $pdf->Cell(0, 15, $pdfname, 0, false, 'C', 0, '', 0, false, 'M', 'M');
});

How can i do that?

标签: laraveltcpdf

解决方案


I moved to use phantomjs and it is working perfecrtly. The Idea I used there is to generate a html file and store it in a temporary place and passing that location to Phantomjs. It generated as a PDF what is inside the html file.

This post helped me to achieve this https://medium.com/@ayusharma.in/generate-pdf-file-using-phantomjs-885a374cda61


推荐阅读