• Resolved josuelo7

    (@josuelo7)


    Hi, you have a really nice plugin I just having a problem with it.

    I already fix it but not in a nice way, because everytime the plugin gets an upgrade I need to edit the files again.

    Here is a Video of the error: https://youtu.be/PclJOwuDzt8

    The error occurs when I add this code in a custom plugin:

    add_filter( ‘wpo_wcpdf_paper_format’, ‘wcpdf_custom_mm_page_size’, 10, 2 );
    function wcpdf_custom_mm_page_size($paper_format, $template_type) {
    // change the values below
    $width = 58; //mm!
    $height = 100; //mm!

    //convert mm to points
    $paper_format = array( 0, 0, ($width/25.4) * 72, ($height/25.4) * 72 );

    return $paper_format;
    }

    When the order have too many items, the fatal error appear.

    I fix it erasing this:

    // Assume the position of the first child
    [$x, $y] = $frame->get_first_child()->get_position();
    $frame->set_position($x, $y);

    From here: wp-content>plugins>woocommerce-pdf-invoices-packing-slips>vendor>dompdf>dompdf>src>FrameReflower>Inline.php

    I dont have almost any knowledge about coding, but it fix it and still working good.

    I just want to know if there is another way to fix it, than erase that code everytime the plugin get updated.

    Thanks for the help.

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

    (@alexmigf)

    Hello @josuelo7

    Can you paste the full stack trace of the error here?

    Plugin Contributor Yordan Soares

    (@yordansoares)

    Hi @josuelo7,

    Editing vendor files is not definitely a good idea.

    That said, in addition to the code snippet you mentioned above, are you using a custom PDF template too? If so, could you please try switching to the default Simple template, under WooCommerce?> PDF?Invoices?> General?> Choose a template, to see whether the issue turns out fixed or it’s still happening?

    Thread Starter josuelo7

    (@josuelo7)

    Hi thanks for the help.

    I was using custom PDF Template and Custom Paper Size, but the error only occurs when the Order was a little large.

    In this moment I can’t reproduce the error, maybe it was fixed with the last dompdf update.

    I see that the code line moved down, last time was the line 169

    // Assume the position of the first child
    [$x, $y] = $frame->get_first_child()->get_position();
    $frame->set_position($x, $y);

    I’ll keep checking if I can reproduce the error and I’ll send you the image

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error when change widht of the paper’ is closed to new replies.