Filter: wr_pdf_template_mpdf_before_write

Allows external plugins to make final changes to the MPDF Instance before generating the PDF.

The return value must be an MPDF Instance.



This filter, for example, may be used to set the HTML header or HTML footer for the PDF.

Example: Add Header and Footer

add_filter( "wr_pdf_template_mpdf_before_write", array( $this, "add_header_and_footer" ), 10, 2 );

public function add_header_and_footer( $mpdf, $identifier ) {
  if($identifier === "pdf_identifier") {
    $mpdf->SetHTMLHeader( '<div style="margin-top: 90px;"> </div>' );
    $mpdf->SetHTMLFooter( '<div class="page-footer" style="margin-top: 20px;"></div>' );

  return $mpdf;
    Your Cart
    Your cart is emptyReturn to Shop