invoice/controllers/Invoice.php
protected function download($oInvoice)
    {
        //  Business details
        $this->data['business'] = (object) [
            'name'       => appSetting('business_name', 'nails/module-invoice'),
            'address'    => appSetting('business_address', 'nails/module-invoice'),
            'telephone'  => appSetting('business_telephone', 'nails/module-invoice'),
            'email'      => appSetting('business_email', 'nails/module-invoice'),
            'vat_number' => appSetting('business_vat_number', 'nails/module-invoice'),
        ];

        $oInvoiceSkinService   = Factory::service('InvoiceSkin', 'nails/module-invoice');
        $sEnabledSkin          = $oInvoiceSkinService->getEnabledSlug() ?: self::DEFAULT_INVOICE_SKIN;
        $this->data['invoice'] = $oInvoice;
        $this->data['isPdf']   = true;
        $sHtml                 = $oInvoiceSkinService->view($sEnabledSkin, 'render', $this->data, true);

        $oPdf = Factory::service('Pdf', 'nails/module-pdf');
        $oPdf->setPaperSize('A4', 'portrait');
        $oPdf->load_html($sHtml);

        $oPdf->download('INVOICE-' . $oInvoice->ref . '.pdf');
    }
protected function download($oInvoice)
    {
        //  Business details
        $this->data['business'] = (object) [
            'name'       => appSetting('business_name', 'nails/module-invoice'),
            'address'    => appSetting('business_address', 'nails/module-invoice'),
            'telephone'  => appSetting('business_telephone', 'nails/module-invoice'),
            'email'      => appSetting('business_email', 'nails/module-invoice'),
            'vat_number' => appSetting('business_vat_number', 'nails/module-invoice'),
        ];

        $oInvoiceSkinService   = Factory::service('InvoiceSkin', 'nails/module-invoice');
        $sEnabledSkin          = $oInvoiceSkinService->getEnabledSlug() ?: self::DEFAULT_INVOICE_SKIN;
        $this->data['invoice'] = $oInvoice;
        $this->data['isPdf']   = true;
        $sHtml                 = $oInvoiceSkinService->view($sEnabledSkin, 'render', $this->data, true);

        $oPdf = Factory::service('Pdf', 'nails/module-pdf');
        $oPdf->setPaperSize('A4', 'portrait');
        $oPdf->load_html($sHtml);

        $oPdf->download('INVOICE-' . $oInvoice->ref . '.pdf');
    }
protected function download ( $ oInvoice ) { //  Business details $ this -> data [ 'business' ] = ( object ) [ 'name' => appSetting ( 'business_name' , 'nails/module-invoice' ) , 'address' => appSetting ( 'business_address' , 'nails/module-invoice' ) , 'telephone' => appSetting ( 'business_telephone' , 'nails/module-invoice' ) , 'email' => appSetting ( 'business_email' , 'nails/module-invoice' ) , 'vat_number' => appSetting ( 'business_vat_number' , 'nails/module-invoice' ) , ] ; $ oInvoiceSkinService = Factory :: service ( 'InvoiceSkin' , 'nails/module-invoice' ) ; $ sEnabledSkin = $ oInvoiceSkinService -> getEnabledSlug ( ) ? : self :: DEFAULT_INVOICE_SKIN ; $ this -> data [ 'invoice' ] = $ oInvoice ; $ this -> data [ 'isPdf' ] = true ; $ sHtml = $ oInvoiceSkinService -> view ( $ sEnabledSkin , 'render' , $ this -> data , true ) ; $ oPdf = Factory :: service ( 'Pdf' , 'nails/module-pdf' ) ; $ oPdf -> setPaperSize ( 'A4' , 'portrait' ) ; $ oPdf -> load_html ( $ sHtml ) ; $ oPdf -> download ( 'INVOICE-' . $ oInvoice -> ref . '.pdf' ) ; }
Download a single invoice

@param  \stdClass $oInvoice The invoice object

@return void
Download a single invoice