简体   繁体   中英

PHP mPDF check-boxes checked in PDF

Disclaimer: know nothing about mPDF :(

I'm creating a PDF file using mPDF , I've manage to get the table printed successfully. I'm having some issues when it comes to getting my checkboxs checked. The checkboxes does not get checked in PDF view, but if I view the same code in HTML it does get checked. for instance

$output .= '<td width="50%" colspan="2">';
  $output .= '<strong>Instructed Another Solicito?</strong> ';
  $output .= 'Yes <input type="checkbox" checked /> ';
  $output .= 'No &nbsp; <input type="checkbox" />';
$output .= '</td>';

If I view them in HTML echo $output; format yes is checked but as soon as I output a pdf file ie $mpdf->WriteHTML($html); $mpdf->Output(); $mpdf->WriteHTML($html); $mpdf->Output(); show as unchecked.

What do I have to do in order to get my checkboxes checked is there any other way to get this

Any Idea?

你应该使用checked="checked"

For those that fell onto this wanting to print a tick symbol, or use the standard symbols at all, read this documentation .

Essentially there are standard fonts that aren't embedded in the document, as they are included in all PDF readers. This is used by default by mPDF, as it creates the smallest documents with the least processing time. These fonts don't include all but the essential symbols, so no tick symbol etc.

However, you can get mPDF to embed a "full" font quite easily, for instance to print a tick:

<p style='font-family:helvetica'>&#10004;</p>

Other standard fonts are available if you look in the docs :)

注意:诸如nowrapdisabledmultiplereadonlyselectedchecked等属性仅支持其正式/长格式,即selected="selected" @ https://mpdf.github.io/html-support/html-attributes.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM