fix(pdf-generation): apply content filters before conversion

Ensured content filters are applied before preprocessing for MathJax to maintain consistency with WordPress content hooks. This change enhances the fidelity of the PDF content by incorporating all WordPress content transformations.
This commit is contained in:
Kumi 2024-08-03 15:37:35 +02:00
parent 9bf5f81c84
commit 600aeba81e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -820,7 +820,8 @@ function handle_pdf_download()
$pdf->setTextColor(0);
$pdf->Ln(10);
$pdf->SetFont('helvetica', '', 12);
$pdf->writeHTML(preprocess_mathjax_content($post->post_content));
$content = apply_filters('the_content', $post->post_content);
$pdf->writeHTML(preprocess_mathjax_content($content));
// Output PDF document
$pdf->Output(sanitize_title($post->post_title) . '.pdf', 'D');