Magento: Changing Font Style in Invoices

Fonts: The invoice uses Libertine. To change this ( I usually change it to helvetica), follow the steps outlined below.

Advertisements

in /app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php

I changed all the references to Libertine to Helvetica with cut and paste.

In /app/code/local/Mage/Sales/Model/Order/Pdf/Items/Abstract.php I changed

    protected function _setFontRegular($size = 7)
   {
        $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf');
        $this->getPage()->setFont($font, $size);
        return $font;
    }

        protected function _setFontBold($size = 7)
    {  
        $font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir() . '/lib/LinLibertineFont/LinLibertine_Bd-2.8.1.ttf');
        $this->getPage()->setFont($font, $size);
        return $font;
    }

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

to

   protected function _setFontRegular($size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
        $this->getPage()->setFont($font, $size);
        return $font;
    }

  protected function _setFontBold($size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD);
        $this->getPage()->setFont($font, $size);
        return $font;
    }

    protected function _setFontItalic($size = 7)
    {
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD_ITALIC);
        $this->getPage()->setFont($font, $size);
        return $font;
    }

Also in /app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php change

$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir()."/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf");

to

$font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);

Tags:

Comments are closed

Latest Comments

No comments to show.