2013-04-05 2 views
1

이 내가 사각형을 볼 수 있습니다 $ 출력을 에코 때 나는, 이미지에 따라 약간의 사각형을 생성하기 위해 노력하고 PDF를 생성하기 위해 노력하고 내 코드에서 HTML에서는 PDF 파일로 인쇄되지 않는 것은

<?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 파일에만 이미지가 인쇄됩니다, 사각형되지 않습니다?

아무도 아이디어가 없습니까 ???

+1

디버그 기능을 추가하여 오류를보고 편집 할 수 있었습니까? '$ mpdf-> debug = true; ' – soumer

답변

0

<span> 태그를 <div> 태그로 변경하면 올바르게 작동합니다.

불행히도 현재 솔루션에 대한 설명이 없습니다. mpdf 스크립트에 따르면 <span> 태그는 enabledtags 컬렉션의 일부입니다 (mpdf.php 23249 라인). 따라서 <div>이 작동하고 <span>이 아닌 이유를 완전히 알지 못합니다.

+0

사각형도 생성 할 수 있었지만 너비와 높이는 pdf에서 작동하지 않습니다. – Dhar