Title: Blank PDF when created programmatically
Last modified: August 30, 2016

---

# Blank PDF when created programmatically

 *  [enderoe](https://wordpress.org/support/users/enderoe/)
 * (@enderoe)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/blank-pdf-when-created-programmatically/)
 * Hi there,
 * Awesome plugin! I am trying to send all customers a PDF in the evening on the
   day of delivery.
 * The problem is that when I create a PDF it is blank. The PDF file has a size 
   107 KB but is completely blank when opened.
 * My code:
 *     ```
       $pdfinvoice = new WooCommerce_PDF_Invoices_Export;
        $template_type= 'invoice';
       $order_ids = array(140);
        $filename = 'theinvoice.pdf';
   
       $dompdf =  $pdfinvoice->generate_pdf( $template_type, $order_ids );
       $output = $dompdf->output();
       file_put_contents($filename, $output);
       ```
   
 * WP_Debug shows no errors 🙁
 * [https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/](https://wordpress.org/plugins/woocommerce-pdf-invoices-packing-slips/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Ewout](https://wordpress.org/support/users/pomegranate/)
 * (@pomegranate)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/blank-pdf-when-created-programmatically/#post-6571777)
 * Hi!
    you don’t need to create a new object for the PDF engine, and the export
   object won’t work without the main plugin object. I’m going to change this later
   this year (applying better architecture/class hierarchy)
 * This thread should get you on track:
    [http://wordpress.org/support/topic/possible-to-send-packing-slip-to-an-email-adress-i-specify?replies=4](http://wordpress.org/support/topic/possible-to-send-packing-slip-to-an-email-adress-i-specify?replies=4)
 * Good luck!

Viewing 1 replies (of 1 total)

The topic ‘Blank PDF when created programmatically’ 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/)

## Tags

 * [pdf](https://wordpress.org/support/topic-tag/pdf/)
 * [programmatically](https://wordpress.org/support/topic-tag/programmatically/)

 * 1 reply
 * 2 participants
 * Last reply from: [Ewout](https://wordpress.org/support/users/pomegranate/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/blank-pdf-when-created-programmatically/#post-6571777)
 * Status: not resolved