Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

347
Views
mPDF (PHP) no reconoce la marca de verificación html

Estoy mostrando una tabla en HTML en mi página web donde una marca de verificación se muestra correctamente (estoy usando ✔ para la marca de verificación en negrita).

Estoy usando classic-asp para mostrar el HTML. La acumulación de html (tableOutput) luego se envía a un script PHP ($output = $_POST["output"]) que usa mPDF.php (versión 6.0) para imprimir en PDF la misma tabla HTML y, de alguna manera, la marca de verificación no se imprime correctamente. (%u2714 en impreso en mi PDF). Todo el resto de la tabla se imprime correctamente, solo la marca de verificación tiene un problema.

Intenté agregar las fuentes Symbola.ttf y Symbola_hint.ttf en la carpeta mpdf\ttfonts pero no funcionó.

HTML (clásico-asp) :

 tableOutput = tableOutput & "<TD class='center pass_x' style='font-family:symbola;'>&#10004;</TD>"

PHP (crear_informe_pdf.php):

 $output = $_POST["output"]; //This is the html buildup tableOutput discussed previously $header = Irrelevant; $footer= Irrelevant; $mpdf = new mPDF( 'utf-8', 'A4-L', 0, '', 5, 5, 20, 20); $mpdf->allow_charset_conversion = true; $mpdf->WriteHTML($style,1); $mpdf->SetHTMLHeader( $header ); $mpdf->SetHTMLFooter( $footer ); $mpdf->WriteHTML( $output ); $mpdf->Output($temp ,'F' );

config_fonts.php (agregué symbola.ttf y Symbola_hint.ttf en la carpeta mpdf\ttfonts):

 $this->fontdata = array ( "symbola" => array ( 'R' => "Symbola.ttf", 'I' => "Symbola_hint.ttf", ),

CSS (la variable de estilo PHP $ apunta a create_report_pdf.css) :

 .report-table{ border: 1px solid black; border-collapse: collapse; font-size: 7pt; width: 100%; } th,td{ font-size: 7pt; border: 1px solid black !important; vertical-align : middle; } .center{ text-align: center; vertical-align: middle; } INPUT{ border-color:#ffffff !important; } .pf{ width: 45px; } .fix-cell{ width: 90px; } .dr-column, .dr-input{ width: 100px; } .comments, .comments-input{ width: 130px; }

Muchas gracias por su ayuda

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Hay dos soluciones posibles:

  • Reemplazando manualmente el %u2714 con la respectiva entidad html &#10004; haciendo lo siguiente:
 $output = str_replace('%u2714', '&#10004;', $output);
  • Implemente un enfoque más genérico que manejará todos esos caracteres especiales. El enfoque se basa en el hecho de que %uXXXX es un esquema de notación no estándar para caracteres Unicode de codificación URL. Por lo tanto, debe convertir la notación %uXXXX a la notación de entidad HTML &#xXXXX; y luego esto puede ser decodificado a UTF-8 real por html_entity_decode.
 $output = preg_replace('/%u([0-9A-F]+)/', '&#x$1;', $output); $output = html_entity_decode($output, ENT_COMPAT, 'UTF-8');
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!