这是我的代码
<?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 中只有图像正在打印,正方形不是?
有人有什么想法吗???