Annotation of /com_supacart/trunk/admin_files/classes/pdf/html2fpdf_site.php
Parent Directory
|
Revision Log
Revision 4 - (view) (download)
| 1 : | andphe | 4 | <?php |
| 2 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 3 : | /** | ||
| 4 : | * @version $Id: html2fpdf_site.php 617 2007-01-04 19:43:08Z soeren_nb $ | ||
| 5 : | * @package SupaCart | ||
| 6 : | * @subpackage HMTL2PDF | ||
| 7 : | * @author Renato Coelho | ||
| 8 : | * See COPYRIGHT.php for copyright notices and details. | ||
| 9 : | * @license GNU/GPL Version 2, see LICENSE.php | ||
| 10 : | * SupaCart is free software, originally derived from Virtuemart. This version may have been modified pursuant | ||
| 11 : | * to the GNU General Public License, and as distributed it includes or | ||
| 12 : | * is derivative of works licensed under the GNU General Public License or | ||
| 13 : | * other free or open source software licenses. | ||
| 14 : | * See /administrator/components/com_supacart/COPYRIGHT.php for copyright notices and details. | ||
| 15 : | * | ||
| 16 : | * http://www.supacart.com | ||
| 17 : | */ | ||
| 18 : | /*///////////////////////////////////////////////////////////////////////////// | ||
| 19 : | //////////////DO NOT MODIFY THE CONTENTS OF THIS BOX////////////////////////// | ||
| 20 : | ////////////////////////////////////////////////////////////////////////////// | ||
| 21 : | // // | ||
| 22 : | // HTML2FPDF is a php script to read a HTML text and generate a PDF file. // | ||
| 23 : | // Copyright (C) 2004 Renato Coelho // | ||
| 24 : | // This script may be distributed as long as the following files are kept // | ||
| 25 : | // together: // | ||
| 26 : | // // | ||
| 27 : | // fpdf.php, html2fpdf.php, gif.php, license.txt,credits.txt,htmltoolkit.php// | ||
| 28 : | // // | ||
| 29 : | ////////////////////////////////////////////////////////////////////////////// | ||
| 30 : | */ | ||
| 31 : | |||
| 32 : | class PDF extends HTML2FPDF { | ||
| 33 : | |||
| 34 : | function PDF() { | ||
| 35 : | //! @return A class instance | ||
| 36 : | //! @desc Constructor | ||
| 37 : | //Call parent constructor | ||
| 38 : | $this->HTML2FPDF(); | ||
| 39 : | //Disable some tags | ||
| 40 : | $this->DisableTags("<big>,<small>"); | ||
| 41 : | //Disable <title>/CSS/<pre> in order to increase script performance | ||
| 42 : | $this->usetitle=false; | ||
| 43 : | $this->usecss=false; | ||
| 44 : | $this->usepre=false; | ||
| 45 : | } | ||
| 46 : | |||
| 47 : | //Common Logo for all HTML files (Montfort) | ||
| 48 : | function InitLogo($src) { | ||
| 49 : | global $mosConfig_live_site; | ||
| 50 : | //! @desc Insert Image Logo on 1st page | ||
| 51 : | //! @return void | ||
| 52 : | if ($src == '') return; | ||
| 53 : | |||
| 54 : | $this->x = $this->lMargin; | ||
| 55 : | $halfwidth = $this->pgwidth/2; | ||
| 56 : | $sizesarray = $this->Image($src, $this->GetX(), $this->GetY(), 0, 0,'','',false); | ||
| 57 : | |||
| 58 : | //Alinhar imagem ao centro | ||
| 59 : | $this->y = $this->tMargin - $sizesarray['HEIGHT']/8; | ||
| 60 : | $this->x = $this->pgwidth- $sizesarray['WIDTH']; | ||
| 61 : | $sizesarray = $this->Image($src, $this->GetX(), $this->GetY(), 0, 0,'', $mosConfig_live_site ); | ||
| 62 : | $this->Ln(1); | ||
| 63 : | //Contruir <HR> particular | ||
| 64 : | $this->SetLineWidth(0.3); | ||
| 65 : | $this->Line($this->x,$this->y,$this->x+$this->pgwidth,$this->y); | ||
| 66 : | $this->SetLineWidth(0.3); | ||
| 67 : | $this->Ln(2); | ||
| 68 : | } | ||
| 69 : | |||
| 70 : | //Put title in page | ||
| 71 : | function PutTitle($titulo) { | ||
| 72 : | //! @desc Insert Title on 1st page | ||
| 73 : | //! @return void | ||
| 74 : | $this->SetTitle($titulo); | ||
| 75 : | $this->Ln(10); | ||
| 76 : | $this->SetFont('Arial','B',22); | ||
| 77 : | $this->divalign="L"; | ||
| 78 : | $this->divwidth = $this->pgwidth; | ||
| 79 : | $this->divheight = 8.5; | ||
| 80 : | |||
| 81 : | //Custom Word Wrap (para melhorar organiza��o das palvras no titulo) | ||
| 82 : | $maxwidth = $this->divwidth; | ||
| 83 : | $titulo = trim($titulo); | ||
| 84 : | $words = preg_split('/ +/', $titulo); | ||
| 85 : | $space = $this->GetStringWidth(' '); | ||
| 86 : | $titulo = ''; | ||
| 87 : | $width = 0; | ||
| 88 : | $numwords = count($words); | ||
| 89 : | for($i = 0 ; $i < $numwords ; $i++) | ||
| 90 : | { | ||
| 91 : | $word = $words[$i]; | ||
| 92 : | if ($i + 1 < $numwords) $nextword = $words[$i+1]; | ||
| 93 : | else $nextword = ''; | ||
| 94 : | $wordwidth = $this->GetStringWidth($word); | ||
| 95 : | $nextwordwidth = $this->GetStringWidth($nextword); | ||
| 96 : | if((strlen($word) <= 3) and ($nextword != '') and ($width + $wordwidth + $nextwordwidth > $maxwidth)) | ||
| 97 : | { | ||
| 98 : | //Para n�o ficar um artigo/preposi��o esquecido(a) no final de uma linha | ||
| 99 : | $width = $wordwidth + $space; | ||
| 100 : | $titulo = rtrim($titulo)."\n".$word.' '; | ||
| 101 : | } | ||
| 102 : | elseif ($width + $wordwidth <= $maxwidth) //Palavra cabe, inserir | ||
| 103 : | { | ||
| 104 : | $width += $wordwidth + $space; | ||
| 105 : | $titulo .= $word.' '; | ||
| 106 : | } | ||
| 107 : | else //Palavra n�o cabe, pular linha e inserir na outra linha | ||
| 108 : | { | ||
| 109 : | $width = $wordwidth + $space; | ||
| 110 : | $titulo = rtrim($titulo)."\n".$word.' '; | ||
| 111 : | } | ||
| 112 : | } | ||
| 113 : | $titulo = rtrim($titulo); | ||
| 114 : | //End of Custom WordWrap | ||
| 115 : | $this->textbuffer[] = array($titulo,'','',array()); | ||
| 116 : | |||
| 117 : | //Print content | ||
| 118 : | $this->printbuffer($this->textbuffer); | ||
| 119 : | //Reset values | ||
| 120 : | $this->textbuffer=array(); | ||
| 121 : | $this->divwidth=0; | ||
| 122 : | $this->divheight=0; | ||
| 123 : | $this->divalign="L"; | ||
| 124 : | $this->SetFont('Arial','',11); | ||
| 125 : | |||
| 126 : | $this->Ln(4); | ||
| 127 : | //Contruir <HR> particular | ||
| 128 : | /* $this->SetLineWidth(0.3); | ||
| 129 : | $this->Line($this->x,$this->y,$this->x+$this->pgwidth,$this->y); | ||
| 130 : | $this->SetLineWidth(0.3); | ||
| 131 : | $this->Ln(2);*/ | ||
| 132 : | } | ||
| 133 : | |||
| 134 : | //Put author in page | ||
| 135 : | function PutAuthor($autor) { | ||
| 136 : | //! @desc Insert Author on 1st page | ||
| 137 : | //! @return void | ||
| 138 : | $this->SetAuthor($autor); | ||
| 139 : | $this->SetFont('Arial','',14); | ||
| 140 : | $this->SetStyle('B',true); | ||
| 141 : | $this->SetStyle('I',true); | ||
| 142 : | $texto = $autor;//'by author' | ||
| 143 : | $this->MultiCell(0,5,$texto,0,'R'); | ||
| 144 : | $this->SetFont('Arial','',11); | ||
| 145 : | $this->SetStyle('B',false); | ||
| 146 : | $this->SetStyle('I',false); | ||
| 147 : | } | ||
| 148 : | |||
| 149 : | //Page footer | ||
| 150 : | function Footer() { | ||
| 151 : | global $mosConfig_live_site, $vendor_name, $VM_LANG; | ||
| 152 : | //! @desc Insert footer on every page | ||
| 153 : | //! @return void | ||
| 154 : | //Position at 1.0 cm from bottom | ||
| 155 : | $this->SetY(-10); | ||
| 156 : | //Copyright //especial para esta vers�o | ||
| 157 : | $this->SetFont('Arial','B',9); | ||
| 158 : | $this->SetTextColor(0); | ||
| 159 : | $texto = "Copyright ".chr(169).date('Y')." - $vendor_name - "; | ||
| 160 : | $this->Cell($this->GetStringWidth($texto),10,$texto,0,0,'L'); | ||
| 161 : | $this->SetTextColor(0,0,255); | ||
| 162 : | $this->SetStyle('U',true); | ||
| 163 : | $this->SetStyle('B',false); | ||
| 164 : | $this->Cell(0,10,$mosConfig_live_site,0,0,'L',0,$mosConfig_live_site); | ||
| 165 : | $this->SetStyle('U',false); | ||
| 166 : | $this->SetTextColor(0); | ||
| 167 : | //Arial italic 9 | ||
| 168 : | $this->SetFont('Arial','I',9); | ||
| 169 : | //Page number | ||
| 170 : | $this->Cell(0,10, $VM_LANG->_PN_PAGE." ".$this->PageNo()." ".$VM_LANG->_PN_OF." {nb}",0,0,'R'); | ||
| 171 : | //Return Font to normal | ||
| 172 : | $this->SetFont('Arial','',11); | ||
| 173 : | } | ||
| 174 : | |||
| 175 : | }//end of class | ||
| 176 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

