• HI there,

    the plugin is no longer works as it shows “Exception: Unable to create new image” at the pdf invoice page every time when I try to create an invoice.

    the error page:
    ========================================================
    Exception: Unable to create new image
    #0 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(4883): Imagick->newimage()
    #1 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(4984): Cpdf->addImagePngAlpha()
    #2 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Adapter/CPDF.php(864): Cpdf->addPngFromFile()
    #3 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer/Image.php(110): Dompdf\Adapter\CPDF->image()
    #4 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(293): Dompdf\Renderer\Image->render()
    #5 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(127): Dompdf\Renderer->_render_frame()
    #6 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\Renderer->render()
    #7 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\Renderer->render()
    #8 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\Renderer->render()
    #9 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\Renderer->render()
    #10 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(194): Dompdf\Renderer->render()
    #11 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/Page.php(148): Dompdf\Renderer->render()
    #12 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(895): Dompdf\FrameReflower\Page->reflow()
    #13 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Dompdf.php(847): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #14 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-pdf-maker.php(53): Dompdf\Dompdf->render()
    #15 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(627): WPO\WC\PDF_Invoices\PDF_Maker->output()
    #16 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(662): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #17 {……}/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(337): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf()
    #18 {……}/wp-includes/class-wp-hook.php(288): WPO\WC\PDF_Invoices\Main->generate_pdf_ajax()
    #19 {……}/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters()
    #20 {……}/wp-includes/plugin.php(478): WP_Hook->do_action()
    #21 {……}/wp-admin/admin-ajax.php(175): do_action()
    #22 {main}
    ===============================================

    I replace {……} with the actual link for security purpose

    please advise thanks!

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

    (@alexmigf)

    Hi @travelavenger

    We need more informations to help you.

    • What is your PHP version?
    • Could you provide us a log going to: WooCommerce -> Status -> Logs
    • This reply was modified 4 years, 8 months ago by alexmigf.
    Thread Starter travelavenger

    (@travelavenger)

    HI there,

    Thank you for the follow up.

    my php version is PHP 7.4.3 and when this error happens, I cannot see any error in the apache error log.

    The woocommerce log is very long, which information do you need for this issue? I am also a tech guy, which part of the system do you think is the most related to this issue?

    Thank you!

    Plugin Contributor Ewout

    (@pomegranate)

    It seems this may be a misconfiguration (perhaps a write permissions issue?) of the ImageMagick (or Imagick) PHP extension. Do you manage the hosting yourself? You may need to check that all PHP libraries match the version of PHP itself.

    Thread Starter travelavenger

    (@travelavenger)

    Hi there,

    Thank you for the information. yes we are using VPS and I have full control. the folder of the pdf is assigned to www-data in ubuntu.

    Do you think uninstall and reinstall the plugin will solve the issue? If so, what are the steps of a clean uninstall? Also any thing I should take a look?

    Thank you!

    Plugin Contributor Ewout

    (@pomegranate)

    No, the error is unrelated to code in this plugin itself, so reinstalling doesn’t make any difference. The plugin (or more specifically, dompdf, a library that we use) calls Imagick for image operations and this seems to crash. This happens at the PHP extension level.
    You could try to reinstall/update the imagick extension, but this is not my expertise so your google search is probably better than mine ??

    When you say “The folder of the pdf is assigned to www-data in ubuntu.” – is this something you have configured manually? Where did you get this information?

    Thread Starter travelavenger

    (@travelavenger)

    hi there,

    I have tried to create the invoice again but this time the error is different:

    Exception: No IDATs written into file `{…}/image/wpo_wcpdf/dompdf/cpdf_img_EoW52l.png’ @ error/png.c/MagickPNGErrorHandler/1628

    Please advise, thank you!

    Plugin Contributor Ewout

    (@pomegranate)

    More and more it looks like a write permissions issue. Have you manually overriden the wp-content folder? wpo_wcpdf would normally be under /wp-content/uploads/ but {…}/image/ doesn’t have any wp-content in it…

    Thread Starter travelavenger

    (@travelavenger)

    Yes, the this folder works fine before without any issue with the plugin. Not sure if it is to do with the upgrade. the overridden configuration is by adding

    define( ‘UPLOADS’, ‘image’ ); at wp-config.php

    where should I look into for permission level error?

    Thank you!

    Plugin Contributor Ewout

    (@pomegranate)

    you could check the {…}/image/wpo_wcpdf/dompdf/ folder write permissions.
    Have you tried reinstalling/updating the ImageMagick/Imagick PHP extension too?

    Thread Starter travelavenger

    (@travelavenger)

    HI there,

    I just reinstalled imagemagick by doing sudo apt-get purge –auto-remove php-imagick
    and reinstall : sudo apt-get install php-imagick

    and verify by : php -m | grep imagick

    also the folder permission of {…}/image/wpo_wcpdf/dompdf/ is drwxr-xr-x www-data:www-data which is the apache user of ubuntu

    but still getting

    Exception: No IDATs written into file `{…}/wpo_wcpdf/dompdf/cpdf_img_Lae7i0.png’ @ error/png.c/MagickPNGErrorHandler/1628

    Any thought? Thank you!

    • This reply was modified 4 years, 8 months ago by travelavenger.
    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @travelavenger

    Try this:

    chmod -R 777 /dir

    /dir = Directory where you want to writing your image

    • This reply was modified 4 years, 8 months ago by alexmigf.
    Thread Starter travelavenger

    (@travelavenger)

    thank you, tried with 777 but same error, before was 775 already given the full right to apache user, any idea?

    Thank you!

    Thread Starter travelavenger

    (@travelavenger)

    Back to my first message there are many error to do with the render() function, does it related to the function by any chance?

    Thread Starter travelavenger

    (@travelavenger)

    Hi there,

    Been using this plugin for long time, just want to confirm if it does work with PHP 7.4.3 ?

    thank you!

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi @travelavenger

    What is the owner and the group of that directory?

    Can you show me the full path to that directory?

    • This reply was modified 4 years, 8 months ago by alexmigf.
Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Exception: Unable to create new image’ is closed to new replies.