I'm trying to add the packingslip pdf as attachment to the shipping email.

I saw this post Attach invoice to shipment email This adds the invoice, but not the packingslip.

The only thing I don't know is how to get the right shipment for creating the PDF. I keep getting the error render on non object.

I tried

$shipmenttt = $order->getShipmentsCollection()->getFirstItem();
$shipmentIncrementId = $shipmenttt->getIncrementId();   
$shipment = $this->load($shipmentIncrementId);
$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf(array($shipment));


$shipment = $this;
$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf(array($shipment));

1 Answer 1


I found out wat is was. and it is very simple:

all you need is:

$pdf = Mage::getModel('sales/order_pdf_shipment')->getPdf(array($this));

The addAttachment function from the link does not work. I changes it to:

public function addAttachment(Zend_Pdf $pdf, $filename)
    $file = $pdf->render();         
    $this->emailTemplate = Mage::getModel('core/email_template');       
    $attachment = $this->emailTemplate->getMail()->createAttachment($file);
    if(!is_object($attachment)) return $this;
    $attachment->type = 'application/pdf';
    $attachment->filename = $filename;
    return $this;

Hope It helps someone else

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.