source-class-Com.Tecnick.Pdf.Tcpdf

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.
  1: <?php
  2: /**
  3:  * Tcpdf.php
  4:  *
  5:  * @since       2002-08-03
  6:  * @category    Library
  7:  * @package     Pdf
  8:  * @author      Nicola Asuni <info@tecnick.com>
  9:  * @copyright   2002-2017 Nicola Asuni - Tecnick.com LTD
 10:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 11:  * @link        https://github.com/tecnickcom/tc-lib-pdf
 12:  *
 13:  * This file is part of tc-lib-pdf software library.
 14:  */
 15: 
 16: namespace Com\Tecnick\Pdf;
 17: 
 18: use \Com\Tecnick\Pdf\Exception as PdfException;
 19: use \Com\Tecnick\Pdf\Encrypt\Encrypt as ObjEncrypt;
 20: 
 21: /**
 22:  * Com\Tecnick\Pdf\Tcpdf
 23:  *
 24:  * Tcpdf PDF class
 25:  *
 26:  * @since       2002-08-03
 27:  * @category    Library
 28:  * @package     Pdf
 29:  * @author      Nicola Asuni <info@tecnick.com>
 30:  * @copyright   2002-2017 Nicola Asuni - Tecnick.com LTD
 31:  * @license     http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 32:  * @link        https://github.com/tecnickcom/tc-lib-pdf
 33:  */
 34: class Tcpdf extends \Com\Tecnick\Pdf\ClassObjects
 35: {
 36:     /**
 37:      * Document ID
 38:      *
 39:      * @var string
 40:      */
 41:     protected $fileid;
 42: 
 43:     /**
 44:      * Unit of measure
 45:      *
 46:      * @var string
 47:      */
 48:     protected $unit = 'mm';
 49: 
 50:     /**
 51:      * Unit of measure conversion ratio
 52:      *
 53:      * @var float
 54:      */
 55:     protected $kunit = 1.0;
 56: 
 57:     /**
 58:      * True if we are in PDF/A mode.
 59:      *
 60:      * @var bool
 61:      */
 62:     protected $pdfa = false;
 63: 
 64:     /**
 65:      * True if we are in PDF/X mode.
 66:      *
 67:      * @var bool
 68:      */
 69:     protected $pdfx = false;
 70: 
 71:     /**
 72:      * True if the signature approval is enabled (for incremental updates).
 73:      *
 74:      * @var bool
 75:      */
 76:     protected $sigapp = false;
 77: 
 78:     /**
 79:      * True to subset the fonts
 80:      *
 81:      * @var boolean
 82:      */
 83:     protected $subsetfont = false;
 84: 
 85:     /**
 86:      * True for Unicode font mode
 87:      *
 88:      * @var boolean
 89:      */
 90:     protected $isunicode = true;
 91: 
 92:     /**
 93:      * Current PDF object number
 94:      *
 95:      * @var int
 96:      */
 97:     protected $pon = 0;
 98: 
 99:     /**
100:      * PDF version
101:      *
102:      * @var string
103:      */
104:     protected $pdfver = '1.7';
105: 
106:     /**
107:      * Defines the way the document is to be displayed by the viewer.
108:      *
109:      * @var string
110:      */
111:     protected $display = array('zoom' => 'default', 'layout' => 'SinglePage', 'mode' => 'UseNone');
112: 
113:     /**
114:      * Initialize a new PDF object
115:      *
116:      * @param string     $unit        Unit of measure ('pt', 'mm', 'cm', 'in')
117:      * @param bool       $isunicode   True if the document is in Unicode mode
118:      * @param bool       $subsetfont  If true subset the embedded fonts to remove the unused characters
119:      * @param string     $mode        PDF mode: "pdfa", "pdfx" or empty
120:      * @param ObjEncrypt $encobj      Encryption object
121:      */
122:     public function __construct(
123:         $unit = 'mm',
124:         $isunicode = true,
125:         $subsetfont = false,
126:         $mode = '',
127:         ObjEncrypt $encobj = null
128:     ) {
129:         setlocale(LC_NUMERIC, 'C');
130:         $this->doctime = time();
131:         $this->docmodtime = $this->doctime;
132:         $seedobj = new \Com\Tecnick\Pdf\Encrypt\Type\Seed();
133:         $this->fileid = md5($seedobj->encrypt('TCPDF'));
134:         $this->unit = $unit;
135:         $this->isunicode = $isunicode;
136:         $this->subsetfont = $subsetfont;
137:         $this->pdfa = ($mode == 'pdfa');
138:         $this->pdfx = ($mode == 'pdfx');
139:         $this->setPDFVersion();
140:         $this->encrypt = $encobj;
141:         $this->initClassObjects();
142:     }
143: 
144:     /**
145:      * Defines the way the document is to be displayed by the viewer.
146:      *
147:      * @param mixed  $zoom   The zoom to use. It can be one of the following string values or a number indicating the
148:      *                       zooming factor to use.
149:      *                       * fullpage: displays the entire page on screen
150:      *                       * fullwidth: uses maximum width of window
151:      *                       * real: uses real size (equivalent to 100% zoom)
152:      *                       * default: uses viewer default mode
153:      * @param string $layout The page layout. Possible values are:
154:      *                       * SinglePage Display one page at a time
155:      *                       * OneColumn Display the pages in one column
156:      *                       * TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left
157:      *                       * TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right
158:      *                       * TwoPageLeft Display the pages two at a time, with odd-numbered pages on the left
159:      *                       * TwoPageRight Display the pages two at a time, with odd-numbered pages on the right
160:      * @param string $mode   A name object specifying how the document should be displayed when opened:
161:      *                       * UseNone Neither document outline nor thumbnail images visible
162:      *                       * UseOutlines Document outline visible
163:      *                       * UseThumbs Thumbnail images visible
164:      *                       * FullScreen Full screen, with no menu bar, window controls, or any other window visible
165:      *                       * UseOC (PDF 1.5) Optional content group panel visible
166:      *                       * UseAttachments (PDF 1.6) Attachments panel visible
167:      */
168:     public function setDisplayMode($zoom = 'default', $layout = 'SinglePage', $mode = 'UseNone')
169:     {
170:         if (is_numeric($zoom) || in_array($zoom, $this->valid_zoom)) {
171:             $this->display['zoom'] = $zoom;
172:         } else {
173:             $this->display['zoom'] = 'default';
174:         }
175:         $this->display['layout'] = $this->page->getLayout($layout);
176:         $this->display['page'] = $this->page->getDisplay($mode);
177:         return $this;
178:     }
179: }
180: 
 

© 2004-2018 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy