Vimeo for WooCommerce

Adder by PM

Pinterest for WooCommerce

Added by Team Desire

WisePad 3 banner

Speed pdf generation and Avoid being blocked by hosting server


I’ve applied a simple patch to your plugin in order to fix my issue with images not being downloaded over http/s (my shared hosting server somehow blocks those external requests, and I failed to get any help from their hotline).
This patch (or similar code, that needs polishing) will not only be useful for people like me but also for all your users having images in their PDF files. Why? Because that saves external http downloads to get images that are already in the local folder of the plugin (within the WordPress wp-content/ folder), which means generation should be faster. For some with lots of big images and slow/metered download connections from their server, that could mean seconds off that generation.

The 1-line patch applies to that file: www/wp-content/plugins/woocommerce-store-catalog-pdf-download/includes/class-wc-store-catalog-pdf-download-ajax.php
at line 99 or something:
$html = ob_get_clean();

/* PATCH */
$html = str_replace(‘ src=”‘ . get_site_url(), ‘ src=”file://’ . get_home_path(), $html);

// render pdf
$dompdf->load_html( $html );

What it does is basically replacing within the page html all img paths starting with something like “” with a new path starting with “file:///usr/home/www”.

I agree this is a dirty string replacement, it might need some polishing like first making sure the string ends with a known image filetype. But that’s the gist of it, I’ve tested it on a couple of pages.
This should be an option within your plugin to activate that extra line of code (by default it would be off, making sure no one’s impacted if it breaks things) – it could be labelled : “DOMPDF: avoid image downloads (experimental)”

That would be just great. I could also then get rid of that line in the plugin and receive future updates without fear it would disappear.


Current Status


Last updated: July 16, 2020


Log in to comment on this feature request.


The most customizable eCommerce platform for building your online business.

  • 30 day money back guarantee
  • Support teams across the world
  • Safe & Secure online payment