MPDF无输出(空白页) [英] MPDF No Output (Blank Page)

查看:50
本文介绍了MPDF无输出(空白页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了MPDF实用程序,以便将HTML& CSS转换为PDF报告. 到目前为止,一切一直很好,直到我尝试将某些页面转换为PDF为止,并且没有任何输出.

I'd installed the MPDF utility in order to convert HTML&CSS to PDF reports. So far things have been working just fine, until I've tried converting certain page to PDF ,and there's no output.

我不得不提到,我能够通过浏览器定期显示页面-仅当我尝试将其转换为PDF时才会出现问题-然后我会收到空​​白页面.而且,没有编码问题(部分输出是用希伯来语编写的,但是我已经克服了这个障碍)

I have to mention that i'm able to display the page regularly through browser - the problem only comes up when i'm trying to convert it to PDF - then I receive blank page. Moreover, there are no encoding problems (part of the output is written in Hebrew, but I've already overcame this obstacle)

这是代码的一部分:

if($customer!=$tempCustomer)
{


    if($tempCustomer!="")
    {
    $html.=("</table>");
    $html.=("</BR>סהכ".$sumTotal."</BR>");
    $html.=("</BR>משטחים".$sumPallets."</BR>");
    }
    $sumTotal=0; //RESET SUM OF EACH CUSTOMER
    $sumPallets=0; //RESET PALLETS COUNT
    $html.=("</div>");
    $html.=("<div class='subTable'>");
//  $html.=("לקוח: ".$customerName."</br>");
    $sumTotal=0;
    $sumPallets=0;
    $tempCustomer=$customer;
        $html.=("<table border='3' 

<tr><td>מגדל</td><td>תאריך</td><td>תעודה</td><td>פריט</td><td>סוג</td><td>גודל</td><td>כמות</td><td>משקל</td><td>מחיר  

מכירה</td><td>סכום</td><td>משטחים</td></tr>");
    $html.=("<tr>");
    $html.=("<td>".$grower."</td>");
    $html.=("<td>".$date."</td>");
    $html.=("<td>".$form."</td>");
    $html.=("<td>".$item."</td>");
    $html.=("<td>".$type."</td>");
    $html.=("<td>".$size."</td>");
    $html.=("<td>".$quantity."</td>");
    $html.=("<td>".$weight."</td>");
    $html.=("<td>".$price."</td>");
    $html.=("<td>".$total."</td>");
    $html.=("<td>".$pallet."</td>");
    $html.=("</tr>");
    $sumTotal+=$total;
    $sumPallets+=$pallet;

}
else
{
    $html.=("<tr>");
    $html.=("<td>".$grower."</td>");
    $html.=("<td>".$date."</td>");
    $html.=("<td>".$form."</td>");
    $html.=("<td>".$item."</td>");
    $html.=("<td>".$type."</td>");
    $html.=("<td>".$size."</td>");
    $html.=("<td>".$quantity."</td>");
    $html.=("<td>".$weight."</td>");
    $html.=("<td>".$price."</td>");
    $html.=("<td>".$total."</td>");
    $html.=("<td>".$pallet."</td>");
    $html.=("</tr>");
    $sumTotal+=$total;
    $sumPallets+=$pallet;

}

/*
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");
$html.=("<td>".$form."</td>");

$html.=("</tr>");
*/
}

$html2='אבדרכדכגכגכגכג';

$html3='אבדרכדכגכגכגכג';

//==============================================================
//MPDF SETTINGS  - CONTINUE
$mpdf->SetAutoFont();

$mpdf->autoFontGroupSize = 1;


$mpdf->SetDirectionality('rtl');

$mpdf->useLang = true;

$mpdf->WriteHTML($html);

$mpdf->Output();
exit;

有什么建议吗?

预先感谢

推荐答案

您是否尝试过调试?每个mpdf的网站:如果浏览器上只有空白屏幕,您什么也看不到,这可能是因为脚本错误.在脚本开始时打开调试.

Have you tried debugging it? Per mpdf's site: If you get nothing but a blank screen on your browser, it may be because there is a script error. Turn on debugging at the start of your script.

<?php
include("../mpdf.php");
$mpdf=new mPDF();

$mpdf->debug = true;

$mpdf->WriteHTML("Hallo World");
$mpdf->Output();
?>

如果以上方法可行,则与您的代码有关.有时,任何html输出之前的单个空格都可能抛出MPDF

If the above works, then it's something with your code. Sometime, even a single space before any html output can throw off MPDF

这篇关于MPDF无输出(空白页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆