2016-12-03 2 views
0

私はcodeigniterを扱っています。私はビューからデータを受け取るファイルにデータを送りますが、それをエコーするとモーダルウィンドウ上に表示されますが、$mpdf->Output();と書いたらすぐにデータは表示されず、画面は次のように表示されます:
The error output on modal windowモーダルウィンドウ上でHTMLエコーとして提供されるデータで、PDFには表示されないデータ

私のhtmlが送信されては、次のとおりです。

$html=''; 

    $html .=' 
       <table width="100%" class="pat-demo" id="pqrs_csv_list"> 
        <thead> 
         <tr> 
          <th class="cols">Measure ID</th> 
          <th class="cols">Measure Name</th> 
          <th class="cols">Met</th> 
          <th class="cols">Not eligible</th> 
          <th class="cols">Not met</th> 
          <th class="cols">Exclusion</th> 
         </tr> 

        </thead> 
        <tbody>'; 

    foreach ($arr as $aRow) 
    { 
     if($counter==2) { $bgcolor =""; $counter=1;} else { $bgcolor = "#FFF9F9"; $counter++; } 



     $html .='<tr bgcolor="'.$bgcolor.'"> 
         <td class="cols" width="8%">'.$aRow['measureId'].'</td> 
         <td class="cols" width="55%%">'.$aRow['measureName'].'</td> 
         <td class="cols" width="8%">'.$this->percentage($aRow[1], $total_visits)."%".'</td> 
         <td class="cols" width="8%">'.$this->percentage($aRow[2], $total_visits)."%".'</td> 
         <td class="cols" width="8%">'.$this->percentage($aRow[3], $total_visits)."%".'</td> 
         <td class="cols" width="8%">'.$this->percentage($aRow[4], $total_visits)."%".'</td> 
        </tr>'; 
    } 

$html .='</tbody> 
      </table>'; 

次に、このHTMLを取り、私はPDFビューアで表示しようとする場所をファイルには、コードを持っています

$mpdf = new mPDF('utf-8', 'A4-L', 0, '', 10, 10, 32, 25, 5, 2,2,'P');  
$mpdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>'); 
$mpdf->SetHTMLFooter($footer); 

$mpdf->defaultheaderfontsize=10; 
$mpdf->defaultheaderfontstyle='B'; 
$mpdf->defaultheaderline=0; 
$mpdf->defaultfooterfontsize=10; 
$mpdf->defaultfooterfontstyle='BI'; 
$mpdf->defaultfooterline=0; 
header('Content-type: application/pdf'); 
$stylesheet = file_get_contents('admin_includes/css/print_pdf.css'); 
$mpdf->WriteHTML($stylesheet,1); 
//echo $html;/// here it echos right but not goes to pdf 
$mpdf->WriteHTML($html); 
$mpdf->Output(); 

答えて

0

追加のヘッダが追加が必要になる場合がありますing。たぶん、次の組み合わせを試してみてください。

header('Content-Type: application/octet-stream'); 
header('Content-Transfer-Encoding: binary'); 
header('Content-disposition: attachment'); 
0

ob_end_clean();ヘッダーの後に( 'Content-type:application/pdf');

+0

が機能しませんでした。問題はまだ同じです –

関連する問題