• Resolved ozviewer

    (@ozviewer)


    Today I get an error message when I try to print either the Invoice or the Packing Slip – No Such File or Directory. I have replaced the name of the website to ‘parent’ and the sub-domain to ‘acme.com’ in the error message only for privacy. I have checked the media dir in WP and the files are there. The DB is not showing any errors. Suggestions please.

    Exception: UnableToOpenBlob `file:///home/parent/acme.com/wp-content/uploads/2019/10/Website-header-logo-128px-e1570250493950.png': No such file or directory @ error/blob.c/OpenBlob/2960
    /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php (5709)
    #0 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(5709): Imagick->__construct('file:///home/ki...')
    #1 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/lib/Cpdf.php(5845): Dompdf\Cpdf->addImagePngAlpha('file:///home/ki...', 57.442913385827, 760.29354330709, 96, 52.5, 3)
    #2 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Adapter/CPDF.php(669): Dompdf\Cpdf->addPngFromFile('file:///home/ki...', 57.442913385827, 760.29354330709, 96, 52.5)
    #3 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer/Image.php(65): Dompdf\Adapter\CPDF->image('file:///home/ki...', 57.442913385827, 29.096456692913, 96, 52.5, 'normal')
    #4 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(289): Dompdf\Renderer\Image->render(Object(Dompdf\FrameDecorator\Image))
    #5 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(128): Dompdf\Renderer->_render_frame('image', Object(Dompdf\FrameDecorator\Image))
    #6 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(195): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Image))
    #7 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(195): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableCell))
    #8 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(195): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableRow))
    #9 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(195): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\TableRowGroup))
    #10 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Renderer.php(195): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Table))
    #11 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameReflower/Page.php(149): Dompdf\Renderer->render(Object(Dompdf\FrameDecorator\Block))
    #12 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(913): Dompdf\FrameReflower\Page->reflow(NULL)
    #13 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/vendor/dompdf/dompdf/src/Dompdf.php(765): Dompdf\FrameDecorator\AbstractFrameDecorator->reflow()
    #14 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/makers/class-pdf-maker.php(53): Dompdf\Dompdf->render()
    #15 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(884): WPO\WC\PDF_Invoices\Makers\PDF_Maker->output()
    #16 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/documents/abstract-wcpdf-order-document.php(950): WPO\WC\PDF_Invoices\Documents\Order_Document->get_pdf()
    #17 /home/parent/acme.com/wp-content/plugins/woocommerce-pdf-invoices-packing-slips/includes/class-wcpdf-main.php(517): WPO\WC\PDF_Invoices\Documents\Order_Document->output_pdf('inline')
    #18 /home/parent/acme.com/wp-includes/class-wp-hook.php(310): WPO\WC\PDF_Invoices\Main->generate_document_ajax('')
    #19 /home/parent/acme.com/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters('', Array)
    #20 /home/parent/acme.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #21 /home/parent/acme.com/wp-admin/admin-ajax.php(188): do_action('wp_ajax_generat...')
    #22 {main}
    
    • This topic was modified 1 year, 4 months ago by ozviewer.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Darren Peyou

    (@dpeyou)

    Hey @ozviewer,

    I wonder if you could be having an issue which may have something to do with the image path (absolute o relative).
    Has there been some type of migration on your site lately?

    Try this code snippet to see if the logo now appears correctly:

    add_filter( 'wpo_wcpdf_use_path', '__return_true', 999 );

    If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use filters

    Thread Starter ozviewer

    (@ozviewer)

    Darren, thanks for your prompt reply. I haven’t made any changes apart from the regular updates. I am on v3.70 of the plugin. Could that be the cause? BTW, I tried the snippet but it made no difference.

    Plugin Contributor alexmigf

    (@alexmigf)

    Hi,

    Can you open this image?

    /home/parent/acme.com/wp-content/uploads/2019/10/Website-header-logo-128px-e1570250493950.png
    Thread Starter ozviewer

    (@ozviewer)

    Hi Alex, if I go to the WP media library and enter into the search bar: Website-header-logo-128px-e1570250493950.png the image is found.

    If I ftp to the website and go to the directory list, the file is at:

    /acme.com/wp-content/uploads/2019/10/Website-header-logo-128px-e1570250493950.png

    As previously stated my site is not acme.com, I am using that as a generic name.

    Plugin Contributor alexmigf

    (@alexmigf)

    Sure, I understand that.

    Could you please enabled the HTML output under the plugin settings Status tab, and inspect the PDF HTML to see what is the image URL? Let me know if you can open that URL in your browser.

    Thread Starter ozviewer

    (@ozviewer)

    Hey Alex, that worked! No error message. The image URL is:

    https://acme.com/wp-content/uploads/2019/10/Website-header-logo-128px-e1570250493950.png

    Plugin Contributor alexmigf

    (@alexmigf)

    Could you now disable the HTML output, and try the code snippet below?

    add_filter( 'wpo_wcpdf_get_html', function ( $html, $document ) {
    	if ( !class_exists('DOMDocument') || stripos( $html, "</html>" ) === false ) {
    		return $html;
    	}
    	$dom = new DOMDocument();
    	$dom->loadHTML( $html );
    
    	foreach ( $dom->getElementsByTagName( 'img' ) as $image ) {
    		$image->setAttribute( 'src', str_replace( trailingslashit( content_url() ), trailingslashit( WP_CONTENT_DIR ), $image->getAttribute( 'src' ) ) );		
    	}
    
    	return $dom->saveHTML($dom);
    }, 10, 2);

    Also remove the code snippet that my colleague suggested. Let me know if this one works better.

    Thread Starter ozviewer

    (@ozviewer)

    Hi Alex, I disabled html output, deleted the earlier snippet, added the new one and….the error is back.

    Plugin Contributor alexmigf

    (@alexmigf)

    Could you send us an email to support@wpovernight.com? We need to investigate further.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Invoices and Slips – no such file or directory’ is closed to new replies.