Good in HTML, bad in mPDF

2019-09-22 08:26发布

问题:

Well, I'm trying to work with mPDF for a week and until now I could figure out almost every issues that I had.

However, there's one last problem that I couldn't solve.

As you can see, this is a document that I need to generate in my e-commerce: https://dicini.com.br/boletophp/boleto_bradesco.php?ped=173
But I need to turn it into a PDF and put a button for the users to download it (I got that part, I don't have problems in put that button). I tried to use mPDF and the result was this:
https://dicini.com.br/teste
Beyond the fact that everything gots "bolder", there is that part that went to right and truncated everything.
To generate the PDF, I'm using this:

require_once('mpdf60/mpdf.php');
$mpdf=new mPDF();
$mpdf->SetDisplayMode('fullpage');
$mpdf->autoMarginPadding = 0;
$mpdf->bleedMargin = 0;
$mpdf->list_indent_first_level = 0;
$mpdf->keep_table_proportions = true;
$mpdf->shrink_tables_to_fit=1;
$mpdf->autoLangToFont = true;
$pdf = file_get_contents("https://dicini.com.br/boletophp/boleto_bradesco.php?ped=173");
$mpdf->WriteHTML($pdf);
$mpdf->Output(); exit;

What can I do to fix that truncated part?

回答1:

Use this to save the pdf in a file in the folder of your choice:

$mpdf->Output('filename.pdf','F');

After putting the button pointing to the file you need to download.

Button To Download .txt File (PHP & HTML)

+Info:

https://mpdf.github.io/reference/mpdf-functions/output.html



标签: php html mpdf