Php 图像上的HTML未以pdf格式打印

Php 图像上的HTML未以pdf格式打印,php,html,mpdf,Php,Html,Mpdf,这是我的密码 <?php class Diagram { function outLet() { $boothsizer = 3; if($boothsizer == 3){ $cellWidth = '112px'; $cellHeight = '52px'; $innerDivElectricTop = '41px'; $innerDivElectricLeft = '110px';

这是我的密码

<?php
class Diagram
{
function outLet()
{
    $boothsizer = 3;

    if($boothsizer ==  3){
        $cellWidth = '112px';
        $cellHeight = '52px';
        $innerDivElectricTop = '41px'; 
        $innerDivElectricLeft = '110px';    
        $backgroundImage = 'url(booth_top_images/5X20TOP.jpg)';
        $width = '900px';
        $height = '225px';
        $sidewalls = 2;
        $backwalls = 6; 
    }
    else
    if($boothsizer ==  19)
    {
        $cellWidth = '144px';
        $cellHeight = '145px';
        $innerDivElectricTop = '105px'; 
        $innerDivElectricLeft =  '73px';    
        $backgroundImage = 'url(booth_top_images/10X10TOP.jpg)';
        $width = '599px';
        $height = '605px';
        $sidewalls = 3;
        $backwalls = 3;
    }

    $innerDivElectricWidth = $backwalls * $cellWidth;
    $innerDivElectricHeight = $sidewalls * $cellHeight;

    $output = '<div style="width:'.$width.'; height:'.$height.'; background-image:'.$backgroundImage.'">';

    $output .= '<div id="inner_div_electric" style="position: relative; top: '.$innerDivElectricTop.'; left: '.$innerDivElectricLeft.';width:'.$innerDivElectricWidth.';height:'.$innerDivElectricHeight.'">';

    for($i=1; $i<=$sidewalls; $i++)
    {
            for($j=1; $j<=$backwalls; $j++)
            {
                $output .= '<span class="droppable_class" style="width:'.($cellWidth-2).'; height:'.($cellHeight-2).'; border:1px solid red; float:left;display:inline-block;margin:0px;padding:0px;"></span>';

            }
    }

    $output .= '</div></div>';

    echo $output;


    include("test/mpdf/mpdf.php");
    $mpdf=new mPDF();   
    $mpdf->ignore_invalid_utf8 = true;
    $stylesheet = file_get_contents('appstyle_pdf.css');
    $mpdf->WriteHTML($stylesheet,1);
    $mpdf->WriteHTML($output);

    $comname = "vam";

    $name = "test/generated_pdfs/".str_replace(" ","-",$comname).".pdf";      
    $mpdf->Output($name,"F");   


}
}

$diag = new Diagram;
print $diag->outLet();
?>
在我的代码中,我尝试在图像上生成一些方块,并尝试生成pdf,当我回显$output时,我可以在图像上看到方块,但在我生成的pdf中,只有图像正在打印,方块没有

有人有什么想法吗?

将标签更改为标签,它应该可以工作


不幸的是,我目前没有任何关于解决方案的解释。根据mpdf脚本,标记是enabledtags集合的一部分-mpdf.php行23249。因此,我不完全确定为什么有效和无效。

请添加调试功能以查看错误并对其进行编辑,好吗$mpdf->debug=true;我也能够生成正方形,但宽度和高度在pdf中不起作用。