diff --git a/add-ons/agency/create-custom-report-templates.mdx b/add-ons/agency/create-custom-report-templates.mdx index a88ba2a..7e75c4c 100644 --- a/add-ons/agency/create-custom-report-templates.mdx +++ b/add-ons/agency/create-custom-report-templates.mdx @@ -169,7 +169,9 @@ If you use multiple font weights, load each font file separately. Defining bold ### Font Works in Preview but Not PDF -Some Pro Reports versions apply a PDF fallback font during PDF generation. If the custom font works in the browser preview but the generated PDF still uses a default font, keep the `@font-face` declarations in the template `
` and add a second stylesheet immediately after the opening `` tag. +By default, Pro Reports does not inject a PDF-only font override, so custom template fonts—including valid `@font-face` declarations—flow through to Dompdf. If Dompdf cannot resolve the requested font, it falls back to its `defaultFont` option. + +If the custom font works in the browser preview but the generated PDF still uses a different font, keep the `@font-face` declarations in the template `` and add a second stylesheet immediately after the opening `` tag. This later stylesheet can reapply the custom font for the PDF output: @@ -188,6 +190,45 @@ This later stylesheet can reapply the custom font for the PDF output: Use this override only when the generated PDF ignores a valid custom font that works in the preview. +#### Inject a global PDF font override with a filter + +If you need to apply the same PDF-only font override to every report without editing each template, use the `mainwp_pro_reports_pdf_font_override_css` filter. Returning a CSS string from this filter injects a `