Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ewout

    (@pomegranate)

    Hi!
    There’s 2 ways of doing this:

    1) Use a custom font that is smaller than the one currently used. To have optimal support for different languages (russian,czech, etc.) the version of Open Sans we use has many characters in it and therefor contributes significantly to the size of the PDF.
    2) Enable font-subsetting. This is a setting that makes sure only the characters used in the document are embedded in the PDF. Do test this with a few orders first though, because it doesn’t work equally well on all servers. You can do this by adding the following code to your themes functions.php:

    define("DOMPDF_ENABLE_FONTSUBSETTING", true);

    Finally, check the size of the header image, naturally this also contributes to the PDF filesize.

    Hope that helps!

    Ewout

    adding define(“DOMPDF_ENABLE_FONTSUBSETTING”, true); makes a significant difference. filesize decreases to 50kb. but i have display errors with the title. so i changed
    <?php if( $wpo_wcpdf->get_header_logo_id() ) echo apply_filters( ‘wpo_wcpdf_invoice_title’, __( ‘Invoice’, ‘wpo_wcpdf’ ) ); ?>
    (which is translated to “Rechnung”)
    to
    <?php if( $wpo_wcpdf->get_header_logo_id() ) echo apply_filters( ‘wpo_wcpdf_invoice_title’, __( ‘RECHNUNG’ ) ); ?>
    no perfect solution but a more a hotfix (for germans).

    Plugin Contributor Ewout

    (@pomegranate)

    Thanks nic! Dompdf only ever sees the output of the code so in theory there should not be any difference, but it may be that the text-transform: uppercase is behaving differently from regular uppercase letters and this is not playing nice with subsetting. Either way, nice trick – thanks for sharing!

    Ewout

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pdf file size’ is closed to new replies.