Sharif
Sharif

Reputation: 728

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 i.e. $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?

Upvotes: 5

Views: 14335

Answers (3)

lemon
lemon

Reputation: 1

Note: Attributes like nowrap, disabled, multiple, readonly, selected and checked are only supported in their formal/long form i.e. selected="selected" @ https://mpdf.github.io/html-support/html-attributes.html

Upvotes: 0

Jamie Robinson
Jamie Robinson

Reputation: 868

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 :)

Upvotes: 2

Amjad
Amjad

Reputation: 2090

You should use checked="checked"

Upvotes: 11

Related Questions