$style='<style>@page *{
margin-top: 0cm;
margin-bottom: 0cm;
margin-left: 0cm;
margin-right: 0cm;
}</style>';
$html ='<img src="temppng/'.$_GET['memid'].'.png" width="325.03937" height="204.094488" `/>';
include("MPDF54/mpdf.php");
$mpdf = new mPDF('utf-8', 'Letter', 0, '', 1, 1, 1, 1, 8, 8);
$mpdf->useAdobeCJK = true;
$mpdf->SetAutoFont(AUTOFONT_ALL);
`$mpdf->SetMargins(0);
$mpdf->WriteHTML('<pagebreak sheet-size="86mm 54mm" />');
$mpdf->WriteHTML($style);
$mpdf->WriteHTML($html);
$mpdf->WriteHTML('<tocentry content="150mm square" />')
$mpdf->DeletePages(1,1);
$mpdf->Output();
Hi,any one know how to delete the bottom white space of the pdf,here is image 'http://tinypic.com/view.php?pic=xfdixj&s=8',i want to delete the bottom white space,any one know how to do?THX
Create it with 0 margins or whatever you'd like accordingly
$mpdf=new mPDF('utf-8', 'Letter', 0, '', 0, 0, 0, 0, 0, 0);
class mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
mpdf page layout can be customize with the following approach
For mpdf version 6.0 we can use
$mpdf=new mPDF('utf-8', 'A4', 0, '', 0, 0, 0, 0, 0, 'L'); // use this customization
The default settings of mPDf in version 6.0 along with the parameters looks like
function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=15,$mgr=15,$mgt=16,$mgb=16,$mgh=9,$mgf=9, $orientation='P')
For mpdf version 7.0 or greater we can use
$mpdf= new \Mpdf\Mpdf(['mode' => 'utf-8','format' => 'A4','margin_left' => 0,'margin_right' => 0,'margin_top' => 0,'margin_bottom' => 0,'margin_header' => 0,'margin_footer' => 0]); //use this customization
The default settings of mPDf in version 7.0 along with the parameters looks like
$constructor = [
'mode' => '',
'format' => 'A4',
'default_font_size' => 0,
'default_font' => '',
'margin_left' => 15,
'margin_right' => 15,
'margin_top' => 16,
'margin_bottom' => 16,
'margin_header' => 9,
'margin_footer' => 9,
'orientation' => 'P',
];
Futher detail regarding the available options of mPDF class can be get from the official documentaion https://mpdf.github.io/reference/mpdf-functions/construct.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With