I have two files located in localhost/invoice
named x.php
and template.php
,
and then I have a URL like this:
localhost/invoice/template.php?name=wawan
How can I convert the output page into a PDF? What I want is to access x.php
and then get the converted template.php
. I tried using mpdf, but it doesn't work.
Here's x.php
:
<?php
include("MPDF54/mpdf.php");
$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0; // 1 or 0 - whether to indent the first level of a list
$mpdf->WriteHTML(file_get_contents('template.php?name=wawan'));
$mpdf->Output();
?>
And this is template.php
:
<div> The name is :
<?php
echo $_GET[name];
?>