Exemplo n.º 1
0
 /**
  * set some standards for all pdf pages
  *
  * @param Fooman_PdfCustomiser_Helper_Pdf $helper
  */
 public function SetStandard(Fooman_PdfCustomiser_Helper_Pdf $helper)
 {
     // set document information
     $this->SetCreator('Magento');
     $this->tcpdflink = false;
     //$this->setPDFVersion('1.4');
     //set margins
     $this->SetMargins($helper->getPdfMargins('sides'), $helper->getPdfMargins('top'));
     // set header and footer
     $printNumbers = Mage::getStoreConfigFlag('sales_pdf/all/allpagenumbers', $helper->getStoreId());
     $this->setPrintFooter($printNumbers || $helper->hasFooter());
     if ($helper->getPdfIntegratedLabels()) {
         //uncomment next line to suppress the footers when using integrated labels
         //$this->setPrintFooter(false);
     }
     $this->setPrintHeader(true);
     $this->setHeaderMargin(0);
     $this->setFooterMargin($helper->getPdfMargins('bottom'));
     // set default monospaced font
     $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     //set auto page breaks
     $this->SetAutoPageBreak(true, $helper->getBottomPageBreak());
     //set image scale factor 3 pixels = 1mm
     $this->setImageScale(self::FACTOR_PIXEL_PER_MM);
     //set image quality
     $this->setJPEGQuality(95);
     //uncomment for quicker file generation when not using core fonts
     //downside is increased file size
     //$this->setFontSubsetting(false);
     // set font
     $this->SetFont($helper->getPdfFont(), '', $helper->getPdfFontsize());
     // set fillcolor black
     $this->SetFillColor(0);
     // see if we need to sign
     if (Mage::getStoreConfig('sales_pdf/all/allsign')) {
         $certificate = Mage::helper('core')->decrypt(Mage::getStoreConfig('sales_pdf/all/allsigncertificate'));
         $certpassword = Mage::helper('core')->decrypt(Mage::getStoreConfig('sales_pdf/all/allsignpassword'));
         // set document signature
         $this->setSignature($certificate, $certificate, $certpassword, '', 2);
     }
     //set Right to Left Language
     if (Mage::app()->getLocale()->getLocaleCode() == 'he_IL' || Mage::app()->getLocale()->getLocaleCode() == 'ar_SA') {
         $this->setRTL(true);
         $helper->setParameter(0, 'rtl', true);
     } else {
         $this->setRTL(false);
         $helper->setParameter(0, 'rtl', false);
     }
     $this->startPageGroup();
 }