Topic on Extension talk:Mpdf

Mpdftags parsing and full copatibility with mPDF library

1
Michele.Fella (talkcontribs)

Methods 1 and 3 for mPDF Headers & Footers are deprecated


MpdfHooks parsing logic in mpdftags_Render function which replace open and close tag before re-including them in <> tags within did not allow me to use methods 2 and 4.


Not sure which are the "for security reason" for cirrent implementation, but simply passing the arguments of mpfdtags to mPDF would allow full compatibility with mPDF and enable usage of all possible mpdf control tags and HTML?

I changed the mpdftags_Render as following;

public static function mpdftags_Render( &$parser ) {
 // Get the parameters that were passed to this function
 $params = func_get_args();
 array_shift( $params );
 // Replace open and close tag for security reason
 //$values = str_replace( [ '<', '>' ], [ '<', '>' ], $params );
 // Insert mpdf tags between <!--mpdf ... mpdf-->
 $return = '<!--mpdf';
 /*
 foreach ( $values as $val ) {
  $return .= "<" . $val . " />\n";
 }
 */
 foreach ( $params as $val ) {
  $return .= "" . $val . "\n";
 }
 $return .= "mpdf-->\n";
 // Return mpdf tags as raw html
 return $parser->insertStripItem( $return );
}
Reply to "Mpdftags parsing and full copatibility with mPDF library"