MPDF 导致 html 字符串出现问题

MPDF causing issue with html string

我有 可编辑的 pdf 表单 需要为此构建我使用了 mpdf,现在示例 html 一个 html 和 <input type="text" name="demo"/> 它工作得很好它生成所需的可编辑 pdf,现在我已经创建了一个表单 link 是

http://clients.nextcrawl.co/simpleservant-form/

这只是一个简单的索引,css 和一些字体,当我尝试将此 html 渲染到 mpdf 中时,出现以下错误!

Notice: Undefined index: fieldname in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 204

Fatal error: Call to undefined method Mpdf\Mpdf::Error() in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 829

我对这些东西还很陌生,所以我真的不知道问题出在哪里,这是我的完整代码

<?php
require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();


$html='
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="css/form.css"/>
</head>
<body>
<div class="container">
    <div class="notification_form">
        <div class="form-header clearfix">

            <div class="align1">
                <h2>
                    <span>ONTARIO COURT OF JUSTICE</span><br/>
                    COUR DE JUSTICE DE L’ONTARIO<br/>
                    <span>PROVINCE OF ONTARIO</span><br/>
                    PROVINCE DE L’ONTARIO
                </h2>
            </div>
            <div class="align2">
                <h1>NOTICE OF INTENTION TO APPEAR<br/>
                    <span>AVIS D’INTENTION DE COMPARAÎTRE</span></h1>
            </div>
            <div class="align3">
                <h3>
                    <span class="bold">Form / Formulaire 8</span><br/>
                    <span class="italic-form">Provincial Offences Act</span><br/>
                    Loi sur les infractions provinciales
                </h3>
            </div>

        </div>


        <div class="form_content">

            <div class="consent">

                <div class="fields-bottom fields-1">

                    <div class="flex1">
                        <p>TAKE NOTICE THAT I,</p>
                    </div>

                    <div class="flex2">
                        <input type="text" class="long"/>
                        <div class="half-width">
                            <p class="italic-form">VEUILLEZE PRENDRE AVIS QUE JE SOISSIGNĖ(E)</p>
                            <p class="font-size-kum">(Family/Company / <span class="italic-form">nom de famille/enterprise</span>)</p>
                        </div>
                    </div>

                    <div class="flex3">
                        <input type="text"/>
                        <div class="half-width">
                            <p>(Given / <span class="italic-form">prėnom</span>)</p>
                        </div>
                    </div>

                    <div class="flex4">
                        <input type="text" class="last"/>
                        <div class="quarter-width">
                            <p class="right">(Initials / <span class="italic-form">initiales</span>)</p>
                        </div>
                    </div>


                </div>

                <div class="fields-bottom fields-2">

                    <div class="flex1">
                        <input type="text">
                        <p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Street / <span class="italic-form">rue</span>)</p>
                    </div>

                    <div class="flex3">
                        <input type="text">
                        <p>(Apt. / <span class="italic-form">app</span>.)</p>
                    </div>

                </div>

                <div class="fields-bottom fields-2 fields-3">

                    <div class="flex1">
                        <input type="text">
                        <p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Province)</p>
                    </div>

                    <div class="flex3">
                        <input type="text">
                        <p>(Postal Code / <span class="italic-form">code postal</span>)</p>
                    </div>

                </div>

                <div class="fields-bottom fields-4">

                    <div class="flex1">
                        <input type="text">
                        <input type="text">
                        <input type="text">
                        <p>(Telephone No / <span class="italic-form">numėro du tėlėphone</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(E-mail Address / <span class="italic-form">adresse de courriel</span>)</p>
                    </div>

                </div>

                <div class="fields-bottom fields-5">

                    <div class="flex1">
                        <input type="text">
                        <p>(Location # /<br/>
                            <span class="italic-form">emplacement #</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Offence number /<br/>
                            <span class="italic-form">numėro de l’infraction</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Offence date: day/month /<br/>
                            <span class="italic-form">date de l’infraction:jour/mois</span>)</p>
                    </div>

                </div>

                <span>wish to give notice of my intention to appear in court to enter a plea of not guilty at the time and place set for the trail respecting the charge set out in the
Offence Notice or Parking Infraction Notice.</span>
                <span class="italic-form">dėsire donner avis de mon intention de comparaître devant le tribunal pour inscrire un plaidoyer de non-culpabilitė à l’heure et au lieu prėvus pour
le procės en rėponse à l’accusation ėnoncėe dans l’avis d’infraction ou l’avis d’infraction de stationnement.</span>

                <div class="court fields-bottom">

                    <div class="block">
                        <input type="radio" name="appear"/>
                        <p>I intend to appear in court to enter a plea at the time and place set for the trial and I wish that it be held in the English lanuage</p>
                    </div>
                    <div class="block">
                        <input type="radio" name="appear"/>
                        <p class="italic-form">J’ai l’intention de comparaître decant le tribunal pour inscrire un plaidoyer à l’heure et au lieu prėvus pour le precės et je dėsire que le procės
                            se dėroule en francais</p>
                    </div>

                </div>


                <div class="fields-bottom fields-6">
                    <div class="flex1">
                        <p>I request a</p>
                        <input type="text">
                        <p>language interpreter for the trial.</p>
                    </div>
                    <div class="flex2">
                        <p>(leave blank if inaplicable)</p>
                    </div>
                </div>

                <div class="fields-bottom fields-6 fields-7">
                    <div class="flex1">
                        <p class="italic-form">Je demande l’aide d’un interprėte de langue</p>
                        <input type="text">
                        <p class="italic-form">pour le precės.</p>
                    </div>
                    <div class="flex2">
                        <p class="italic-form">(à remplir, s’il y a lieu)</p>
                    </div>
                </div>

                <div class="sign">

                    <div class="sign1">
                        <p><span>Note:</span> if you <span>fail to notify</span>  the court office of <span>address changes</span> you may not
                            receive important notices e.g., your Notice of trial. You may be convicted in
                            your absence if you do not attend the trial.</p>
                        <input type="text"/>
                        <p class="sign-p">Signature of defendant /<br/>
                            <span class="italic-form">signature du dėfendeur / de la dėfenderesse</span> </p>
                    </div>

                    <div class="sign2">
                        <p class="italic-form"><span>Remarque:</span> Si vous <span>omettez de prėvenir</span> le greffe du tribunal de
                            <span>tout changement d’adresse</span>, vous pouriez ne pas recevoir
                            d’importants avis (p.ex.,votre avis de procės). Vous pourriez
                            ėtre dėclarė(e) coupable en votre absence si vous n’assistez pas
                            au procės.</p>
                        <p class="middle">Date</p>
                        <input type="text" class="middle"/>
                    </div>

                </div>
            </div>

            <div class="border-parent">
                <div class="dashed-border"></div>
            </div>

            <div class="consent">
                <div class="banda-sign">
                    <p>Representative’s Name & Address / <span class="italic-form">non et adresse du reprėsentant / de la reprėsentate</span></p>
                </div>

                <div class="fields-bottom fields-8">
                    <div class="flex1">
                        <input type="text">
                        <p>(Name / <span class="italic-form">nom</span>)</p>
                    </div>
                </div>

                <div class="fields-bottom fields-2 fields-9">

                    <div class="flex1">
                        <input type="text">
                        <p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Street / <span class="italic-form">rue</span>)</p>
                    </div>

                    <div class="flex3">
                        <input type="text">
                        <p>(Apt. / <span class="italic-form">app</span>.)</p>
                    </div>

                </div>

                <div class="fields-bottom fields-2 fields-3 fields-9">

                    <div class="flex1">
                        <input type="text">
                        <p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
                    </div>

                    <div class="flex2">
                        <input type="text">
                        <p>(Province)</p>
                    </div>

                    <div class="flex3">
                        <input type="text">
                        <p>(Postal Code / <span class="italic-form">code postal</span>)</p>
                    </div>

                </div>

            </div>

        </div>

    </div>

</div>
</body>
</html>';

$mpdf->useActiveForms = true;
//$mpdf->formUseZapD = false;
//$mpdf->form_border_color = '0.6 0.6 0.72';
//$mpdf->form_button_border_width = '2';
//$mpdf->form_button_border_style = 'S';
//$mpdf->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
//$mpdf->form_radio_background_color = '0.9 0.9 0.9';
$mpdf->WriteHTML($html,0);
$mpdf->Output();


//$mpdf->WriteHTML($html);
//// OUTPUT
//$mpdf->Output(); exit;

我确实在使用 composer 进行图书馆管理,任何人都可以帮助解决问题吗?

调用未定义的方法致命错误已在新版本 7.1.6 中修复,从 composer 升级。

关于未定义的索引,在mPDF Github issue tracker中提出问题。