Magento Invoice PDF Style and Content Alteration

Step1: Move the Below Base Folder are move your local folder

app\code\local\Mage\Sales\Model\Order\Pdf

Include the Fonts and Style:

protected function _setFontItalic($object, $size = 7)
    {
        $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/roboto.italic.ttf');
        $object->setFont($font, $size);
        return $font;
    }

Font Function Call:

$this->_setFontItaltalic($page, 24);

Include the new Text Content:

$page->drawText(Mage::helper('sales')->__('FOR YOUR ORDER.'), 165, $this->y, 'UTF-8');

Draw the Line:

$page->drawLine(25, $this->y, 570, $this->y);

Draw the Box Style:

$page->drawRectangle(25, $top, 275, ($top - 25));

Create a New Page for PDF:

public function newPage(array $settings = array())
    {
        /* Add new table head */
        $page = $this->_getPdf()->newPage(Zend_Pdf_Page::SIZE_A4);
        $this->_getPdf()->pages[] = $page;
        $this->y = 800;
        if (!empty($settings['table_header'])) {
            $this->_drawHeader($page);
        }
        return $page;
    }

 

Note : 

$this->y(y-axis)

this variable is used to align the content in vertical postion

Leave a Reply

Your email address will not be published. Required fields are marked *