Reputation:
i tried for set custom size paper in MPDF like this
$mpdf = new mPDF('utf-8', array(190,236));
but cannot work, anyone know how it's work?
Upvotes: 0
Views: 277
Reputation: 11
I just tested your class initialization in the included example example01_basic.php
and it's working fine. Maybe you just don't recognize the difference with your eyes. Try something more visible like $mpdf = new mPDF('utf-8', array(130, 130));
.
Give it a try with this example file:
$html = '<h1>my test headline</h1><p>that is my body text</p>';
require_once __DIR__ . '/../vendor/autoload.php';
$mpdf = new mPDF('utf-8', array(130, 130));
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
Edit:
As you pointed out in your comment, you want to change the margin of the page. You could edit the page styles via CSS.
For testing add the following CSS Snippet to your PDF included HTML:
<style>
@page {
margin-top: 10mm;
margin-bottom: 10mm;
margin-left: 5mm;
margin-right: 5mm;
}
</style>
If you want to style your page for production use, you should take a look in the MPDF included example13_paging_css.php
. Here you can see the recommended way to use stylesheets in MPDF.
// LOAD a stylesheet
$stylesheet = file_get_contents('mpdfstylePaged.css');
$mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
Upvotes: 1