In TCPDF (PHP), starting the pdf with table of contents (TOC) causes HTML radio buttons to disappear

时间:2017-03-22 18:50:18

标签: php radio-button pdf-generation tcpdf

I noticed using TCPDF, HTML radio buttons disappear if the table of contents (TOC) appears before the page containing them. Below I set up a simple unit test. Passing it a true puts the table of contents as the first page. The bug appears as the radio button doesn't show up.

Passing a false causes the table of contents to show up last, and thus the bug disappears as the radio button does show up.

function seeTocAffectsRadioButtons($is_first_page=true) {
    require_once(ROOT_PDF.'/tcpdf.php');
    $pdf = new TCPDF();

    // First page
    $pdf->AddPage();
    $pdf->Bookmark("First Page");
    $pdf->WriteHTML('<input type="radio" name="myName" value="myValue">My Radio Button Should Be Here');
    $pdf->endPage();

    // Making Table of Contents
    $pdf->addTOCPage();
    $page_num = $is_first_page ? 1 : 2;
    $pdf->addTOC($page_num);
    $pdf->endTOCPage();

    $pdf->Output('Test.pdf');
}

I want to be able to just pass in html radio buttons with WriteHTML just in case, but will the program have to use TCPDF::RadioButtons instead?

0 个答案:

没有答案