Title: Run from CLI
Last modified: September 1, 2016

---

# Run from CLI

 *  Resolved [andreas83b](https://wordpress.org/support/users/andreas83b/)
 * (@andreas83b)
 * [10 years ago](https://wordpress.org/support/topic/run-from-cli/)
 * hi,
 * i like to run your wonderful plugin from cli,
    but when i try to generate a pdf
   from command line the content of the html table is always empty.
 * my code looks like:
 * require_once( ‘wp-load.php’ );
 * $invoice = new WooCommerce_PDF_Invoices_Export();
    $invoice->enable_debug(); 
   $pdf= $invoice->get_pdf(“packing-slip”, array(“1129”)); file_put_contents( “invoice.
   pdf”, $pdf);
 * [https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [andreas83b](https://wordpress.org/support/users/andreas83b/)
 * (@andreas83b)
 * [10 years ago](https://wordpress.org/support/topic/run-from-cli/#post-7471215)
 * let me answer my own question:
 * require_once( ‘wp-load.php’ );
    $wpo_wcpdf = new WooCommerce_PDF_Invoices(); 
   $wpo_wcpdf->load_classes(); $pdf = $wpo_wcpdf->export->get_pdf(“packing-slip”,
   array(“1129”)); file_put_contents( “invoice.pdf”, $pdf);
 * this works for me.
 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [10 years ago](https://wordpress.org/support/topic/run-from-cli/#post-7471242)
 * Hi! That’s correct. The Export class doesn’t work on it’s own. I’m working on
   restructuring the plugin architecture (it was originally a fork of another plugin),
   which will make stuff like this much easier. Until then – this should work fine.
 * Happy coding! 🙂
    Ewout

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Run from CLI’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce-pdf-invoices-packing-slips/assets/icon-256x256.
   png?rev=2189942)
 * [PDF Invoices & Packing Slips for WooCommerce](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-pdf-invoices-packing-slips/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/run-from-cli/#post-7471242)
 * Status: resolved