A-A+

How to Increase Invoice Sizes in Magento?

2012年06月29日 灵犀一指 How to Increase Invoice Sizes in Magento?已关闭评论 阅读 843 人 次

有事你需要增加发票代码,那么就看看吧:

Instructions

 

  1. Increase Paper Size

    • 1

      Make a copy of the Magento core file by first typing "yourdomainname.com"/app/code/local/Mage/Sales/Model/Order/Pdf/" into the domain search bar. Replace "yourdomainname" with your domain's actual name. Copy all of the information on this PDF script page. Then type "yourdomainname.com/app/code/local/Mage/Sales/Model/Order/Pdf/" into the domain search bar and paste the core file information at this new "local" file. You should use the "local" copy as the new invoice file and save the core file as a backup default.

    • 2

      Go to the PHP script for the invoice by typing "yourdomainname.com/app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php" into the domain search bar. This is the PHP script page that was created when a copy was saved in the local index. This script will say "local" also and should not say "core."

    • 3

      Scroll down the .php script until you see the string "$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);". Where you see "Page::SIZE_A4);" change the A4 for the appropriate paper size that you wish to use. Paper sizes can include Letter, B3 and C2.

    • 4

      Save by returning to the dashboard.

    Increase Font Size

    • 5

      Save a copy of the core file if you have not already done so. Then go to the PHP script for the invoice by typing "yourdomain.com/app/code/local/Mage/Sales/Model/Order/Pdf/Invoice.php" into the domain search bar. This is the same script you use to change page sizes in Magento.

    • 6

      Scroll down until you see the script for "Regular Font." It should look like:

      "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;

      }"

      To change the size, replace the number 7 with the preferred number. You can also change to a larger font style by changing the font style name "LinLibertine" to the preferred font style name.

    • 7

      Repeat the step above using the same numbers and font style for "Bold Font" and "Italic Font." These should be directly below the script for "Regular Font." Changes will save automatically when you leave the script.

    • 8

      Type "yourdomain.com/app/code/local/Mage/Sales/Model/Order/Pdf/Abstract.php" into the domain search bar and then scroll down until you see the string "$font = Zend_Pdf_Font::fontWithPath(Mage::getBaseDir()."/lib/LinLibertineFont/LinLibertineC_Re-2.8.0.ttf")". If you changed the font style, change the font style again here.

    • 9

      Save by returning to the dashboard. You can review your changes at the front end and make edits as needed.

 

标签:

评论已关闭!