html2fpdf问题

时间:2011-09-04 13:36:06

标签: php html pdf html2pdf

将以下html提交到我的html2pdfconverter.php文件时,导出会忽略生物信息疾病和伤害标题:

<div id = "container" style="width: 625px;">
    <div id = "leftcontainer">
        <h4>Biological Information</h4>
        <div id = "bioinfo">
            <ul>
                <li><span>Morning Bodyweight (kg): </span></li>
                <li><span>Evening Bodyweight (kg): </span></li>
                <li><span>Morning Heart Rate (bpm): </span></li>
            </ul>
        </div>

        <h4>Fatigue & Recovery</h4>
        <div id = "fatigue">
            <ul>
                <li><span>Estimated Fluid Consumption (Litres):</span></li>
                <li><span>Sleep Quality:</span></li>
                <li><span>Sleep Quantity (Hours): </span></li>
                <li><span>Mental Recovery:</span></li>
                <li><span>Physical Recovery:</span></li>
                <li><span>Pre-Training Energy:</span></li>
                <li><span>Muscle Soreness:</span></li>
                <li><span>General Fatigue:</span></li>
            </ul>
        </div>                                                
    </div>
    <div id = "rightcontainer">                                                                                   
        <h4>Illness & Injury</h4>
        <div id = "illness">
            <ul>
                <li><span>Are You Ill:</span></li>
                <li><span>Are You Injured:</span></li>
            </ul>
        </div>

        <h4>Training</h4>
        <div id = "training">
            <ul>
                <li><span>Morning Session Duration (minutes):</span></li>
                <li><span>Morning Session Intensity:</span></li>
                <li><span>Evening Session Duration (minutes):</span></li>
                <li><span>Evening Session Intensity:</span></li>
            </ul>
        </div>

        <h4>General Comments</h4>
        <div id = "comments">
            <ul>
                <li><span>General Feedback (10 - 100 characters):</span></li>
            </ul>
        </div>
    </div>
</div>

我得到以下内容:

<div id = "container" style="width: 625px;">
    <div id = "leftcontainer">
        <div id = "bioinfo">
            <ul>
                <li><span>Morning Bodyweight (kg): </span></li>
                <li><span>Evening Bodyweight (kg): </span></li>
                <li><span>Morning Heart Rate (bpm): </span></li>
            </ul>
        </div>

        <h4>Fatigue & Recovery</h4>
        <div id = "fatigue">
            <ul>
            <li><span>Estimated Fluid Consumption (Litres):</span></li>
                <li><span>Sleep Quality:</span></li>
                <li><span>Sleep Quantity (Hours): </span></li>
                <li><span>Mental Recovery:</span></li>
                <li><span>Physical Recovery:</span></li>
                <li><span>Pre-Training Energy:</span></li>
                <li><span>Muscle Soreness:</span></li>
                <li><span>General Fatigue:</span></li>
            </ul>
        </div>
    </div>

    <div id = "rightcontainer">                                                                                        
        <div id = "illness">
            <ul>
                <li><span>Are You Ill:</span></li>
                <li><span>Are You Injured:</span></li>
            </ul>
        </div>

        <h4>Training</h4>
        <div id = "training">
            <ul>
                <li><span>Morning Session Duration (minutes):</span></li>
                <li><span>Morning Session Intensity:</span></li>
                <li><span>Evening Session Duration (minutes):</span></li>
                <li><span>Evening Session Intensity:</span></li>
            </ul>
        </div>

        <h4>General Comments</h4>
        <div id = "comments">
            <ul>
                <li><span>General Feedback (10 - 100 characters):</span></li>
            </ul>
        </div>
    </div>
</div>

这必须与以下事实有关:它们都是div部分下面的第一个标题......我只是不确定它们为什么不被导出。

正在将HTML发送到html2pdf生成器文件。

如果我将h4标签更改为p标签,它可以正常工作......但它不适用于任何其他标头标签......还有其他人遇到过这个问题吗?

1 个答案:

答案 0 :(得分:0)

我有一个相当笨重的解决方案,但嘿它有效....

我所做的是在每个新div下面的第一个标题上方添加一个空div。

e.g。

<div id = "leftcontainer">
<div></div>
<h4>Biological Information</h4>
.
.
.
</div>