Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MPFD中的自定义尺寸纸张_Php_Mpdf - Fatal编程技术网

Php MPFD中的自定义尺寸纸张

Php MPFD中的自定义尺寸纸张,php,mpdf,Php,Mpdf,我试着在MPDF中设置自定义尺寸的纸张,如下所示 $mpdf = new mPDF('utf-8', array(190,236)); 但是无法工作,有人知道它是如何工作的吗?我刚刚在附带的示例example01_basic.php中测试了您的类初始化,它工作正常。也许你只是看不出你的眼睛有什么不同。尝试一些更明显的东西,比如$mpdf=new-mpdf'utf-8',array130130 使用以下示例文件进行尝试: $html = '<h1>my test headline&l

我试着在MPDF中设置自定义尺寸的纸张,如下所示

$mpdf = new mPDF('utf-8', array(190,236));

但是无法工作,有人知道它是如何工作的吗?

我刚刚在附带的示例example01_basic.php中测试了您的类初始化,它工作正常。也许你只是看不出你的眼睛有什么不同。尝试一些更明显的东西,比如$mpdf=new-mpdf'utf-8',array130130

使用以下示例文件进行尝试:

$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;

什么文件autoload.php?它是位于MPDF\vendor目录中的自动加载器。这就是在项目中包含库的方式。另请参见手册中的部分。include_once APPPATH'/third_party/mpdf/mpdf.php';我使用这个,它是不同的?这也应该很好。您是否收到PDF输出或一些错误消息?
<style>
@page {
    margin-top: 10mm;
    margin-bottom: 10mm;
    margin-left: 5mm;
    margin-right: 5mm;
}
</style>
// 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