www/fpdf/fpdf.php

Sun, 30 Oct 2022 16:46:03 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 30 Oct 2022 16:46:03 +0100
changeset 841
60bb365fb48d
parent 77
a9f8de2d7b2b
permissions
-rw-r--r--

Removed use of obsolete product equipment fields and added the equipment chiller fields. Changed tab 2 of the product view to show the chiller method.

77
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 <?php
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 /*******************************************************************************
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 * FPDF *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 * Version: 1.81 *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
6 * Date: 2015-12-20 *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 * Author: Olivier PLATHEY *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 *******************************************************************************/
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 define('FPDF_VERSION','1.81');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 class FPDF
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 protected $page; // current page number
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 protected $n; // current object number
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 protected $offsets; // array of object offsets
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 protected $buffer; // buffer holding in-memory PDF
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 protected $pages; // array containing pages
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 protected $state; // current document state
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 protected $compress; // compression flag
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 protected $k; // scale factor (number of points in user unit)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 protected $DefOrientation; // default orientation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 protected $CurOrientation; // current orientation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24 protected $StdPageSizes; // standard page sizes
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25 protected $DefPageSize; // default page size
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 protected $CurPageSize; // current page size
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 protected $CurRotation; // current page rotation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 protected $PageInfo; // page-related data
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 protected $wPt, $hPt; // dimensions of current page in points
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
30 protected $w, $h; // dimensions of current page in user unit
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
31 protected $lMargin; // left margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
32 protected $tMargin; // top margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33 protected $rMargin; // right margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34 protected $bMargin; // page break margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 protected $cMargin; // cell margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36 protected $x, $y; // current position in user unit
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 protected $lasth; // height of last printed cell
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
38 protected $LineWidth; // line width in user unit
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39 protected $fontpath; // path containing fonts
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40 protected $CoreFonts; // array of core font names
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
41 protected $fonts; // array of used fonts
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
42 protected $FontFiles; // array of font files
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
43 protected $encodings; // array of encodings
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
44 protected $cmaps; // array of ToUnicode CMaps
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
45 protected $FontFamily; // current font family
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
46 protected $FontStyle; // current font style
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
47 protected $underline; // underlining flag
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
48 protected $CurrentFont; // current font info
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
49 protected $FontSizePt; // current font size in points
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
50 protected $FontSize; // current font size in user unit
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
51 protected $DrawColor; // commands for drawing color
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
52 protected $FillColor; // commands for filling color
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
53 protected $TextColor; // commands for text color
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
54 protected $ColorFlag; // indicates whether fill and text colors are different
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
55 protected $WithAlpha; // indicates whether alpha channel is used
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
56 protected $ws; // word spacing
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
57 protected $images; // array of used images
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
58 protected $PageLinks; // array of links in pages
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
59 protected $links; // array of internal links
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
60 protected $AutoPageBreak; // automatic page breaking
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
61 protected $PageBreakTrigger; // threshold used to trigger page breaks
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
62 protected $InHeader; // flag set when processing header
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
63 protected $InFooter; // flag set when processing footer
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
64 protected $AliasNbPages; // alias for total number of pages
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
65 protected $ZoomMode; // zoom display mode
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
66 protected $LayoutMode; // layout display mode
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
67 protected $metadata; // document properties
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
68 protected $PDFVersion; // PDF version number
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
69
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
70 /*******************************************************************************
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
71 * Public methods *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
72 *******************************************************************************/
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
73
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
74 function __construct($orientation='P', $unit='mm', $size='A4')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
75 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
76 // Some checks
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
77 $this->_dochecks();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
78 // Initialization of properties
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
79 $this->state = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
80 $this->page = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
81 $this->n = 2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
82 $this->buffer = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
83 $this->pages = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
84 $this->PageInfo = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
85 $this->fonts = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
86 $this->FontFiles = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
87 $this->encodings = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
88 $this->cmaps = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
89 $this->images = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
90 $this->links = array();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
91 $this->InHeader = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
92 $this->InFooter = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
93 $this->lasth = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
94 $this->FontFamily = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
95 $this->FontStyle = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
96 $this->FontSizePt = 12;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
97 $this->underline = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
98 $this->DrawColor = '0 G';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
99 $this->FillColor = '0 g';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
100 $this->TextColor = '0 g';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
101 $this->ColorFlag = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
102 $this->WithAlpha = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
103 $this->ws = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
104 // Font path
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
105 if(defined('FPDF_FONTPATH'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
106 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
107 $this->fontpath = FPDF_FONTPATH;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
108 if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
109 $this->fontpath .= '/';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
110 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
111 elseif(is_dir(dirname(__FILE__).'/font'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
112 $this->fontpath = dirname(__FILE__).'/font/';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
113 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
114 $this->fontpath = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
115 // Core fonts
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
116 $this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
117 // Scale factor
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
118 if($unit=='pt')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
119 $this->k = 1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
120 elseif($unit=='mm')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
121 $this->k = 72/25.4;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
122 elseif($unit=='cm')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
123 $this->k = 72/2.54;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
124 elseif($unit=='in')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
125 $this->k = 72;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
126 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
127 $this->Error('Incorrect unit: '.$unit);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
128 // Page sizes
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
129 $this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
130 'letter'=>array(612,792), 'legal'=>array(612,1008));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
131 $size = $this->_getpagesize($size);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
132 $this->DefPageSize = $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
133 $this->CurPageSize = $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
134 // Page orientation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
135 $orientation = strtolower($orientation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
136 if($orientation=='p' || $orientation=='portrait')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
137 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
138 $this->DefOrientation = 'P';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
139 $this->w = $size[0];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
140 $this->h = $size[1];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
141 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
142 elseif($orientation=='l' || $orientation=='landscape')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
143 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
144 $this->DefOrientation = 'L';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
145 $this->w = $size[1];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
146 $this->h = $size[0];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
147 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
148 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
149 $this->Error('Incorrect orientation: '.$orientation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
150 $this->CurOrientation = $this->DefOrientation;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
151 $this->wPt = $this->w*$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
152 $this->hPt = $this->h*$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
153 // Page rotation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
154 $this->CurRotation = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
155 // Page margins (1 cm)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
156 $margin = 28.35/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
157 $this->SetMargins($margin,$margin);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
158 // Interior cell margin (1 mm)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
159 $this->cMargin = $margin/10;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
160 // Line width (0.2 mm)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
161 $this->LineWidth = .567/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
162 // Automatic page break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
163 $this->SetAutoPageBreak(true,2*$margin);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
164 // Default display mode
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
165 $this->SetDisplayMode('default');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
166 // Enable compression
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
167 $this->SetCompression(true);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
168 // Set default PDF version number
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
169 $this->PDFVersion = '1.3';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
170 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
171
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
172 function SetMargins($left, $top, $right=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
173 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
174 // Set left, top and right margins
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
175 $this->lMargin = $left;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
176 $this->tMargin = $top;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
177 if($right===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
178 $right = $left;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
179 $this->rMargin = $right;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
180 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
181
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
182 function SetLeftMargin($margin)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
183 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
184 // Set left margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
185 $this->lMargin = $margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
186 if($this->page>0 && $this->x<$margin)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
187 $this->x = $margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
188 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
189
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
190 function SetTopMargin($margin)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
191 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
192 // Set top margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
193 $this->tMargin = $margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
194 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
195
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
196 function SetRightMargin($margin)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
197 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
198 // Set right margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
199 $this->rMargin = $margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
200 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
201
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
202 function SetAutoPageBreak($auto, $margin=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
203 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
204 // Set auto page break mode and triggering margin
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
205 $this->AutoPageBreak = $auto;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
206 $this->bMargin = $margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
207 $this->PageBreakTrigger = $this->h-$margin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
208 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
209
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
210 function SetDisplayMode($zoom, $layout='default')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
211 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
212 // Set display mode in viewer
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
213 if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
214 $this->ZoomMode = $zoom;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
215 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
216 $this->Error('Incorrect zoom display mode: '.$zoom);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
217 if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
218 $this->LayoutMode = $layout;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
219 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
220 $this->Error('Incorrect layout display mode: '.$layout);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
221 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
222
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
223 function SetCompression($compress)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
224 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
225 // Set page compression
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
226 if(function_exists('gzcompress'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
227 $this->compress = $compress;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
228 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
229 $this->compress = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
230 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
231
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
232 function SetTitle($title, $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
233 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
234 // Title of document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
235 $this->metadata['Title'] = $isUTF8 ? $title : utf8_encode($title);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
236 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
237
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
238 function SetAuthor($author, $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
239 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
240 // Author of document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
241 $this->metadata['Author'] = $isUTF8 ? $author : utf8_encode($author);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
242 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
243
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
244 function SetSubject($subject, $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
245 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
246 // Subject of document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
247 $this->metadata['Subject'] = $isUTF8 ? $subject : utf8_encode($subject);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
248 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
249
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
250 function SetKeywords($keywords, $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
251 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
252 // Keywords of document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
253 $this->metadata['Keywords'] = $isUTF8 ? $keywords : utf8_encode($keywords);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
254 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
255
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
256 function SetCreator($creator, $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
257 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
258 // Creator of document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
259 $this->metadata['Creator'] = $isUTF8 ? $creator : utf8_encode($creator);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
260 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
261
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
262 function AliasNbPages($alias='{nb}')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
263 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
264 // Define an alias for total number of pages
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
265 $this->AliasNbPages = $alias;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
266 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
267
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
268 function Error($msg)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
269 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
270 // Fatal error
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
271 throw new Exception('FPDF error: '.$msg);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
272 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
273
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
274 function Close()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
275 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
276 // Terminate document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
277 if($this->state==3)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
278 return;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
279 if($this->page==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
280 $this->AddPage();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
281 // Page footer
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
282 $this->InFooter = true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
283 $this->Footer();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
284 $this->InFooter = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
285 // Close page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
286 $this->_endpage();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
287 // Close document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
288 $this->_enddoc();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
289 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
290
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
291 function AddPage($orientation='', $size='', $rotation=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
292 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
293 // Start a new page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
294 if($this->state==3)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
295 $this->Error('The document is closed');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
296 $family = $this->FontFamily;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
297 $style = $this->FontStyle.($this->underline ? 'U' : '');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
298 $fontsize = $this->FontSizePt;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
299 $lw = $this->LineWidth;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
300 $dc = $this->DrawColor;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
301 $fc = $this->FillColor;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
302 $tc = $this->TextColor;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
303 $cf = $this->ColorFlag;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
304 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
305 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
306 // Page footer
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
307 $this->InFooter = true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
308 $this->Footer();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
309 $this->InFooter = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
310 // Close page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
311 $this->_endpage();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
312 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
313 // Start new page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
314 $this->_beginpage($orientation,$size,$rotation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
315 // Set line cap style to square
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
316 $this->_out('2 J');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
317 // Set line width
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
318 $this->LineWidth = $lw;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
319 $this->_out(sprintf('%.2F w',$lw*$this->k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
320 // Set font
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
321 if($family)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
322 $this->SetFont($family,$style,$fontsize);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
323 // Set colors
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
324 $this->DrawColor = $dc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
325 if($dc!='0 G')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
326 $this->_out($dc);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
327 $this->FillColor = $fc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
328 if($fc!='0 g')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
329 $this->_out($fc);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
330 $this->TextColor = $tc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
331 $this->ColorFlag = $cf;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
332 // Page header
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
333 $this->InHeader = true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
334 $this->Header();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
335 $this->InHeader = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
336 // Restore line width
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
337 if($this->LineWidth!=$lw)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
338 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
339 $this->LineWidth = $lw;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
340 $this->_out(sprintf('%.2F w',$lw*$this->k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
341 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
342 // Restore font
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
343 if($family)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
344 $this->SetFont($family,$style,$fontsize);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
345 // Restore colors
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
346 if($this->DrawColor!=$dc)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
347 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
348 $this->DrawColor = $dc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
349 $this->_out($dc);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
350 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
351 if($this->FillColor!=$fc)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
352 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
353 $this->FillColor = $fc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
354 $this->_out($fc);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
355 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
356 $this->TextColor = $tc;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
357 $this->ColorFlag = $cf;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
358 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
359
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
360 function Header()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
361 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
362 // To be implemented in your own inherited class
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
363 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
364
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
365 function Footer()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
366 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
367 // To be implemented in your own inherited class
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
368 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
369
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
370 function PageNo()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
371 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
372 // Get current page number
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
373 return $this->page;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
374 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
375
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
376 function SetDrawColor($r, $g=null, $b=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
377 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
378 // Set color for all stroking operations
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
379 if(($r==0 && $g==0 && $b==0) || $g===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
380 $this->DrawColor = sprintf('%.3F G',$r/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
381 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
382 $this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
383 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
384 $this->_out($this->DrawColor);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
385 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
386
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
387 function SetFillColor($r, $g=null, $b=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
388 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
389 // Set color for all filling operations
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
390 if(($r==0 && $g==0 && $b==0) || $g===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
391 $this->FillColor = sprintf('%.3F g',$r/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
392 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
393 $this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
394 $this->ColorFlag = ($this->FillColor!=$this->TextColor);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
395 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
396 $this->_out($this->FillColor);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
397 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
398
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
399 function SetTextColor($r, $g=null, $b=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
400 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
401 // Set color for text
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
402 if(($r==0 && $g==0 && $b==0) || $g===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
403 $this->TextColor = sprintf('%.3F g',$r/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
404 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
405 $this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
406 $this->ColorFlag = ($this->FillColor!=$this->TextColor);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
407 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
408
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
409 function GetStringWidth($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
410 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
411 // Get width of a string in the current font
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
412 $s = (string)$s;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
413 $cw = &$this->CurrentFont['cw'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
414 $w = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
415 $l = strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
416 for($i=0;$i<$l;$i++)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
417 $w += $cw[$s[$i]];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
418 return $w*$this->FontSize/1000;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
419 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
420
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
421 function SetLineWidth($width)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
422 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
423 // Set line width
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
424 $this->LineWidth = $width;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
425 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
426 $this->_out(sprintf('%.2F w',$width*$this->k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
427 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 function Line($x1, $y1, $x2, $y2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
430 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431 // Draw a line
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
434
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
435 function Rect($x, $y, $w, $h, $style='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
436 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 // Draw a rectangle
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 if($style=='F')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
439 $op = 'f';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 elseif($style=='FD' || $style=='DF')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 $op = 'B';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 $op = 'S';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 function AddFont($family, $style='', $file='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449 // Add a TrueType, OpenType or Type1 font
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450 $family = strtolower($family);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 if($file=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 $file = str_replace(' ','',$family).strtolower($style).'.php';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 $style = strtoupper($style);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 if($style=='IB')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
455 $style = 'BI';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 $fontkey = $family.$style;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 if(isset($this->fonts[$fontkey]))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 return;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 $info = $this->_loadfont($file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 $info['i'] = count($this->fonts)+1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 if(!empty($info['file']))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 // Embedded font
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 if($info['type']=='TrueType')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 $this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
467 $this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
468 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
469 $this->fonts[$fontkey] = $info;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
471
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
472 function SetFont($family, $style='', $size=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
473 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474 // Select a font; size given in points
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 if($family=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
476 $family = $this->FontFamily;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
477 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478 $family = strtolower($family);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
479 $style = strtoupper($style);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
480 if(strpos($style,'U')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 $this->underline = true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
483 $style = str_replace('U','',$style);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
484 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
485 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
486 $this->underline = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
487 if($style=='IB')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
488 $style = 'BI';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489 if($size==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
490 $size = $this->FontSizePt;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
491 // Test if font is already selected
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
492 if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
493 return;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
494 // Test if font is already loaded
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
495 $fontkey = $family.$style;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
496 if(!isset($this->fonts[$fontkey]))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
497 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 // Test if one of the core fonts
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
499 if($family=='arial')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
500 $family = 'helvetica';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501 if(in_array($family,$this->CoreFonts))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
503 if($family=='symbol' || $family=='zapfdingbats')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
504 $style = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
505 $fontkey = $family.$style;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
506 if(!isset($this->fonts[$fontkey]))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
507 $this->AddFont($family,$style);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
508 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
509 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
510 $this->Error('Undefined font: '.$family.' '.$style);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 // Select it
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
513 $this->FontFamily = $family;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514 $this->FontStyle = $style;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
515 $this->FontSizePt = $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516 $this->FontSize = $size/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
517 $this->CurrentFont = &$this->fonts[$fontkey];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
518 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
519 $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
520 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
521
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
522 function SetFontSize($size)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
523 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
524 // Set font size in points
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
525 if($this->FontSizePt==$size)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
526 return;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
527 $this->FontSizePt = $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
528 $this->FontSize = $size/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
529 if($this->page>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
533 function AddLink()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
535 // Create a new internal link
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
536 $n = count($this->links)+1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 $this->links[$n] = array(0, 0);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
538 return $n;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
539 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
541 function SetLink($link, $y=0, $page=-1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
542 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
543 // Set destination of internal link
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544 if($y==-1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
545 $y = $this->y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 if($page==-1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 $page = $this->page;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548 $this->links[$link] = array($page, $y);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 function Link($x, $y, $w, $h, $link)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
553 // Put a link on the page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 $this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
556
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 function Text($x, $y, $txt)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
558 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
559 // Output a string
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
560 if(!isset($this->CurrentFont))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 $this->Error('No font has been set');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 $s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 if($this->underline && $txt!='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 $s .= ' '.$this->_dounderline($x,$y,$txt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 if($this->ColorFlag)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566 $s = 'q '.$this->TextColor.' '.$s.' Q';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 $this->_out($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 function AcceptPageBreak()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 // Accept automatic page break or not
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
573 return $this->AutoPageBreak;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
575
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
577 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
578 // Output a cell
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 $k = $this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
582 // Automatic page break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 $x = $this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 $ws = $this->ws;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 if($ws>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 $this->ws = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588 $this->_out('0 Tw');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
589 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
590 $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591 $this->x = $x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 if($ws>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 $this->ws = $ws;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 $this->_out(sprintf('%.3F Tw',$ws*$k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
597 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 if($w==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 $s = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
601 if($fill || $border==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 if($fill)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
604 $op = ($border==1) ? 'B' : 'f';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 $op = 'S';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607 $s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609 if(is_string($border))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 $x = $this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 $y = $this->y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 if(strpos($border,'L')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
614 $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
615 if(strpos($border,'T')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616 $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 if(strpos($border,'R')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 if(strpos($border,'B')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620 $s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 if($txt!=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 if(!isset($this->CurrentFont))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
625 $this->Error('No font has been set');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 if($align=='R')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 $dx = $w-$this->cMargin-$this->GetStringWidth($txt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
628 elseif($align=='C')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 $dx = ($w-$this->GetStringWidth($txt))/2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
630 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 $dx = $this->cMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632 if($this->ColorFlag)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
633 $s .= 'q '.$this->TextColor.' ';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 $s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$this->_escape($txt));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
635 if($this->underline)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
636 $s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637 if($this->ColorFlag)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
638 $s .= ' Q';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
639 if($link)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
640 $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
641 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
642 if($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
643 $this->_out($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
644 $this->lasth = $h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
645 if($ln>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
646 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
647 // Go to next line
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
648 $this->y += $h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
649 if($ln==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
650 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
651 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
652 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
653 $this->x += $w;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
654 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
655
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
656 function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
657 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
658 // Output text with automatic or explicit line breaks
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
659 if(!isset($this->CurrentFont))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
660 $this->Error('No font has been set');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
661 $cw = &$this->CurrentFont['cw'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
662 if($w==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
663 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
664 $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
665 $s = str_replace("\r",'',$txt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
666 $nb = strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
667 if($nb>0 && $s[$nb-1]=="\n")
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
668 $nb--;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
669 $b = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
670 if($border)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 if($border==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
673 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
674 $border = 'LTRB';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675 $b = 'LRT';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
676 $b2 = 'LR';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
677 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
678 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
679 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
680 $b2 = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
681 if(strpos($border,'L')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
682 $b2 .= 'L';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
683 if(strpos($border,'R')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
684 $b2 .= 'R';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
685 $b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
688 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689 $i = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
690 $j = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 $ns = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 $nl = 1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 while($i<$nb)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
695 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 // Get next character
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 $c = $s[$i];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 if($c=="\n")
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
699 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
700 // Explicit line break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
701 if($this->ws>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
702 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703 $this->ws = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704 $this->_out('0 Tw');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
707 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
709 $j = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
710 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 $ns = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
712 $nl++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 if($border && $nl==2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 $b = $b2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 continue;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717 if($c==' ')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719 $sep = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 $ls = $l;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 $ns++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 $l += $cw[$c];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
724 if($l>$wmax)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
725 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726 // Automatic line break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727 if($sep==-1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 if($i==$j)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 if($this->ws>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 $this->ws = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 $this->_out('0 Tw');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 if($align=='J')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 $this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
744 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 $i = $sep+1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 $j = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 $ns = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 $nl++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753 if($border && $nl==2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754 $b = $b2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759 // Last chunk
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
760 if($this->ws>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762 $this->ws = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 $this->_out('0 Tw');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
765 if($border && strpos($border,'B')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 $b .= 'B';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
769 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
770
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
771 function Write($h, $txt, $link='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 // Output text in flowing mode
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774 if(!isset($this->CurrentFont))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
775 $this->Error('No font has been set');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 $cw = &$this->CurrentFont['cw'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778 $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 $s = str_replace("\r",'',$txt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 $nb = strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
781 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 $i = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
783 $j = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
784 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 $nl = 1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786 while($i<$nb)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 // Get next character
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789 $c = $s[$i];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790 if($c=="\n")
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 // Explicit line break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
796 $j = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798 if($nl==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
802 $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
804 $nl++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
805 continue;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
806 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 if($c==' ')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
808 $sep = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 $l += $cw[$c];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 if($l>$wmax)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
811 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
812 // Automatic line break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 if($sep==-1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 if($this->x>$this->lMargin)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
817 // Move to next line
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
819 $this->y += $h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
821 $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
822 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
823 $nl++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
824 continue;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
825 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826 if($i==$j)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',false,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832 $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',false,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 $i = $sep+1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835 $sep = -1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836 $j = $i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 $l = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
838 if($nl==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
839 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
840 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 $w = $this->w-$this->rMargin-$this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
842 $wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
843 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
844 $nl++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
845 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847 $i++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
848 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
849 // Last chunk
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
850 if($i!=$j)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
851 $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',false,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
852 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
853
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 function Ln($h=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
855 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
856 // Line feed; default value is the last cell height
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
857 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
858 if($h===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
859 $this->y += $this->lasth;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
860 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 $this->y += $h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
862 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
863
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
864 function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
865 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
866 // Put an image on the page
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
867 if($file=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
868 $this->Error('Image file name is empty');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 if(!isset($this->images[$file]))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
870 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
871 // First use of this image, get info
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
872 if($type=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
873 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
874 $pos = strrpos($file,'.');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
875 if(!$pos)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
876 $this->Error('Image file has no extension and no type was specified: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
877 $type = substr($file,$pos+1);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
879 $type = strtolower($type);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
880 if($type=='jpeg')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 $type = 'jpg';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 $mtd = '_parse'.$type;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 if(!method_exists($this,$mtd))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
884 $this->Error('Unsupported image type: '.$type);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
885 $info = $this->$mtd($file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
886 $info['i'] = count($this->images)+1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
887 $this->images[$file] = $info;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
888 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
889 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
890 $info = $this->images[$file];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
891
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892 // Automatic width and height calculation if needed
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
893 if($w==0 && $h==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
894 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
895 // Put image at 96 dpi
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
896 $w = -96;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
897 $h = -96;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
898 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
899 if($w<0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
900 $w = -$info['w']*72/$w/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
901 if($h<0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
902 $h = -$info['h']*72/$h/$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
903 if($w==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
904 $w = $h*$info['w']/$info['h'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
905 if($h==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
906 $h = $w*$info['h']/$info['w'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
907
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
908 // Flowing mode
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
909 if($y===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
910 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
911 if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
912 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
913 // Automatic page break
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
914 $x2 = $this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
915 $this->AddPage($this->CurOrientation,$this->CurPageSize,$this->CurRotation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
916 $this->x = $x2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
917 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
918 $y = $this->y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
919 $this->y += $h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
920 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
921
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
922 if($x===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
923 $x = $this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
924 $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
925 if($link)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
926 $this->Link($x,$y,$w,$h,$link);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
927 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
928
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
929 function GetPageWidth()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
930 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
931 // Get current page width
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
932 return $this->w;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
933 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
934
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
935 function GetPageHeight()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
936 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
937 // Get current page height
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
938 return $this->h;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
939 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
940
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
941 function GetX()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
942 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
943 // Get x position
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
944 return $this->x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
945 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
946
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
947 function SetX($x)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
948 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
949 // Set x position
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
950 if($x>=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
951 $this->x = $x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
952 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
953 $this->x = $this->w+$x;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
954 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
955
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
956 function GetY()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
957 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
958 // Get y position
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
959 return $this->y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
960 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
961
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
962 function SetY($y, $resetX=true)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
963 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
964 // Set y position and optionally reset x
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
965 if($y>=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
966 $this->y = $y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
967 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
968 $this->y = $this->h+$y;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
969 if($resetX)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
970 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
971 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
972
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
973 function SetXY($x, $y)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
974 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
975 // Set x and y positions
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
976 $this->SetX($x);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
977 $this->SetY($y,false);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
978 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
979
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
980 function Output($dest='', $name='', $isUTF8=false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
981 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
982 // Output PDF to some destination
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
983 $this->Close();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
984 if(strlen($name)==1 && strlen($dest)!=1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
985 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
986 // Fix parameter order
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
987 $tmp = $dest;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
988 $dest = $name;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
989 $name = $tmp;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
990 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
991 if($dest=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
992 $dest = 'I';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
993 if($name=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
994 $name = 'doc.pdf';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
995 switch(strtoupper($dest))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
996 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
997 case 'I':
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
998 // Send to standard output
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
999 $this->_checkoutput();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1000 if(PHP_SAPI!='cli')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1001 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1002 // We send to a browser
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1003 header('Content-Type: application/pdf');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1004 header('Content-Disposition: inline; '.$this->_httpencode('filename',$name,$isUTF8));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1005 header('Cache-Control: private, max-age=0, must-revalidate');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1006 header('Pragma: public');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1007 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1008 echo $this->buffer;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1009 break;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1010 case 'D':
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1011 // Download file
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1012 $this->_checkoutput();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1013 header('Content-Type: application/x-download');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1014 header('Content-Disposition: attachment; '.$this->_httpencode('filename',$name,$isUTF8));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1015 header('Cache-Control: private, max-age=0, must-revalidate');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1016 header('Pragma: public');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1017 echo $this->buffer;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1018 break;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1019 case 'F':
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1020 // Save to local file
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1021 if(!file_put_contents($name,$this->buffer))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1022 $this->Error('Unable to create output file: '.$name);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1023 break;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1024 case 'S':
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1025 // Return as a string
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1026 return $this->buffer;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1027 default:
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1028 $this->Error('Incorrect output destination: '.$dest);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1029 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1030 return '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1031 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1032
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1033 /*******************************************************************************
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1034 * Protected methods *
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1035 *******************************************************************************/
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1036
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1037 protected function _dochecks()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1038 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1039 // Check mbstring overloading
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1040 if(ini_get('mbstring.func_overload') & 2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1041 $this->Error('mbstring overloading must be disabled');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1042 // Ensure runtime magic quotes are disabled
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1043 if(get_magic_quotes_runtime())
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1044 @set_magic_quotes_runtime(0);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1045 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1046
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1047 protected function _checkoutput()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1048 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1049 if(PHP_SAPI!='cli')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1050 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1051 if(headers_sent($file,$line))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1052 $this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1053 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1054 if(ob_get_length())
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1055 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1056 // The output buffer is not empty
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1057 if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1058 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1059 // It contains only a UTF-8 BOM and/or whitespace, let's clean it
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1060 ob_clean();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1061 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1062 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1063 $this->Error("Some data has already been output, can't send PDF file");
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1064 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1065 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1066
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1067 protected function _getpagesize($size)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1068 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1069 if(is_string($size))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1070 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1071 $size = strtolower($size);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1072 if(!isset($this->StdPageSizes[$size]))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1073 $this->Error('Unknown page size: '.$size);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1074 $a = $this->StdPageSizes[$size];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1075 return array($a[0]/$this->k, $a[1]/$this->k);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1076 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1077 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1078 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1079 if($size[0]>$size[1])
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1080 return array($size[1], $size[0]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1081 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1082 return $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1083 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1084 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1085
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1086 protected function _beginpage($orientation, $size, $rotation)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1087 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1088 $this->page++;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1089 $this->pages[$this->page] = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1090 $this->state = 2;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1091 $this->x = $this->lMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1092 $this->y = $this->tMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1093 $this->FontFamily = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1094 // Check page size and orientation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1095 if($orientation=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1096 $orientation = $this->DefOrientation;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1097 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1098 $orientation = strtoupper($orientation[0]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1099 if($size=='')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1100 $size = $this->DefPageSize;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1101 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1102 $size = $this->_getpagesize($size);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1103 if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1])
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1104 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1105 // New size or orientation
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1106 if($orientation=='P')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1107 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1108 $this->w = $size[0];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1109 $this->h = $size[1];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1110 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1111 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1112 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1113 $this->w = $size[1];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1114 $this->h = $size[0];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1115 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1116 $this->wPt = $this->w*$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1117 $this->hPt = $this->h*$this->k;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1118 $this->PageBreakTrigger = $this->h-$this->bMargin;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1119 $this->CurOrientation = $orientation;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1120 $this->CurPageSize = $size;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1121 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1122 if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1])
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1123 $this->PageInfo[$this->page]['size'] = array($this->wPt, $this->hPt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1124 if($rotation!=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1125 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1126 if($rotation%90!=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1127 $this->Error('Incorrect rotation value: '.$rotation);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1128 $this->CurRotation = $rotation;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1129 $this->PageInfo[$this->page]['rotation'] = $rotation;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1130 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1131 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1132
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1133 protected function _endpage()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1134 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1135 $this->state = 1;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1136 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1137
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1138 protected function _loadfont($font)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1139 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1140 // Load a font definition file from the font directory
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1141 if(strpos($font,'/')!==false || strpos($font,"\\")!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1142 $this->Error('Incorrect font definition file name: '.$font);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1143 include($this->fontpath.$font);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1144 if(!isset($name))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1145 $this->Error('Could not include font definition file');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1146 if(isset($enc))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1147 $enc = strtolower($enc);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1148 if(!isset($subsetted))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1149 $subsetted = false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1150 return get_defined_vars();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1151 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1152
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1153 protected function _isascii($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1154 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1155 // Test if string is ASCII
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1156 $nb = strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1157 for($i=0;$i<$nb;$i++)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1158 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1159 if(ord($s[$i])>127)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1160 return false;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1161 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1162 return true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1163 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1164
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1165 protected function _httpencode($param, $value, $isUTF8)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1166 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1167 // Encode HTTP header field parameter
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1168 if($this->_isascii($value))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1169 return $param.'="'.$value.'"';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1170 if(!$isUTF8)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1171 $value = utf8_encode($value);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1172 if(strpos($_SERVER['HTTP_USER_AGENT'],'MSIE')!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1173 return $param.'="'.rawurlencode($value).'"';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1174 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1175 return $param."*=UTF-8''".rawurlencode($value);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1176 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1177
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1178 protected function _UTF8toUTF16($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1179 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1180 // Convert UTF-8 to UTF-16BE with BOM
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1181 $res = "\xFE\xFF";
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1182 $nb = strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1183 $i = 0;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1184 while($i<$nb)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1185 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1186 $c1 = ord($s[$i++]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1187 if($c1>=224)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1188 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1189 // 3-byte character
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1190 $c2 = ord($s[$i++]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1191 $c3 = ord($s[$i++]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1192 $res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1193 $res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1194 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1195 elseif($c1>=192)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1196 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1197 // 2-byte character
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1198 $c2 = ord($s[$i++]);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1199 $res .= chr(($c1 & 0x1C)>>2);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1200 $res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1201 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1202 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1203 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1204 // Single-byte character
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1205 $res .= "\0".chr($c1);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1206 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1207 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1208 return $res;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1209 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1210
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1211 protected function _escape($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1212 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1213 // Escape special characters
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1214 if(strpos($s,'(')!==false || strpos($s,')')!==false || strpos($s,'\\')!==false || strpos($s,"\r")!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1215 return str_replace(array('\\','(',')',"\r"), array('\\\\','\\(','\\)','\\r'), $s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1216 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1217 return $s;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1218 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1219
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1220 protected function _textstring($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1221 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1222 // Format a text string
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1223 if(!$this->_isascii($s))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1224 $s = $this->_UTF8toUTF16($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1225 return '('.$this->_escape($s).')';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1226 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1227
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1228 protected function _dounderline($x, $y, $txt)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1229 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1230 // Underline text
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1231 $up = $this->CurrentFont['up'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1232 $ut = $this->CurrentFont['ut'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1233 $w = $this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1234 return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1235 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1236
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1237 protected function _parsejpg($file)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1238 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1239 // Extract info from a JPEG file
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1240 $a = getimagesize($file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1241 if(!$a)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1242 $this->Error('Missing or incorrect image file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1243 if($a[2]!=2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1244 $this->Error('Not a JPEG file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1245 if(!isset($a['channels']) || $a['channels']==3)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1246 $colspace = 'DeviceRGB';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1247 elseif($a['channels']==4)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1248 $colspace = 'DeviceCMYK';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1249 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1250 $colspace = 'DeviceGray';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1251 $bpc = isset($a['bits']) ? $a['bits'] : 8;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1252 $data = file_get_contents($file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1253 return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1254 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1255
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1256 protected function _parsepng($file)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1257 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1258 // Extract info from a PNG file
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1259 $f = fopen($file,'rb');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1260 if(!$f)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1261 $this->Error('Can\'t open image file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1262 $info = $this->_parsepngstream($f,$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1263 fclose($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1264 return $info;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1265 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1266
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1267 protected function _parsepngstream($f, $file)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1268 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1269 // Check signature
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1270 if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1271 $this->Error('Not a PNG file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1272
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1273 // Read header chunk
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1274 $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1275 if($this->_readstream($f,4)!='IHDR')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1276 $this->Error('Incorrect PNG file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1277 $w = $this->_readint($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1278 $h = $this->_readint($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1279 $bpc = ord($this->_readstream($f,1));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1280 if($bpc>8)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1281 $this->Error('16-bit depth not supported: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1282 $ct = ord($this->_readstream($f,1));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1283 if($ct==0 || $ct==4)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1284 $colspace = 'DeviceGray';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1285 elseif($ct==2 || $ct==6)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1286 $colspace = 'DeviceRGB';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1287 elseif($ct==3)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1288 $colspace = 'Indexed';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1289 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1290 $this->Error('Unknown color type: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1291 if(ord($this->_readstream($f,1))!=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1292 $this->Error('Unknown compression method: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1293 if(ord($this->_readstream($f,1))!=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1294 $this->Error('Unknown filter method: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1295 if(ord($this->_readstream($f,1))!=0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1296 $this->Error('Interlacing not supported: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1297 $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1298 $dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1299
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1300 // Scan chunks looking for palette, transparency and image data
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1301 $pal = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1302 $trns = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1303 $data = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1304 do
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1305 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1306 $n = $this->_readint($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1307 $type = $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1308 if($type=='PLTE')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1309 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1310 // Read palette
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1311 $pal = $this->_readstream($f,$n);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1312 $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1313 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1314 elseif($type=='tRNS')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1315 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1316 // Read transparency info
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1317 $t = $this->_readstream($f,$n);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1318 if($ct==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1319 $trns = array(ord(substr($t,1,1)));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1320 elseif($ct==2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1321 $trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1)));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1322 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1323 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1324 $pos = strpos($t,chr(0));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1325 if($pos!==false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1326 $trns = array($pos);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1327 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1328 $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1329 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1330 elseif($type=='IDAT')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1331 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1332 // Read image data block
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1333 $data .= $this->_readstream($f,$n);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1334 $this->_readstream($f,4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1335 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1336 elseif($type=='IEND')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1337 break;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1338 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1339 $this->_readstream($f,$n+4);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1340 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1341 while($n);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1342
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1343 if($colspace=='Indexed' && empty($pal))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1344 $this->Error('Missing palette in '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1345 $info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1346 if($ct>=4)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1347 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1348 // Extract alpha channel
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1349 if(!function_exists('gzuncompress'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1350 $this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1351 $data = gzuncompress($data);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1352 $color = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1353 $alpha = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1354 if($ct==4)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1355 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1356 // Gray image
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1357 $len = 2*$w;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1358 for($i=0;$i<$h;$i++)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1359 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1360 $pos = (1+$len)*$i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1361 $color .= $data[$pos];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1362 $alpha .= $data[$pos];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1363 $line = substr($data,$pos+1,$len);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1364 $color .= preg_replace('/(.)./s','$1',$line);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1365 $alpha .= preg_replace('/.(.)/s','$1',$line);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1366 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1367 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1368 else
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1369 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1370 // RGB image
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1371 $len = 4*$w;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1372 for($i=0;$i<$h;$i++)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1373 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1374 $pos = (1+$len)*$i;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1375 $color .= $data[$pos];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1376 $alpha .= $data[$pos];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1377 $line = substr($data,$pos+1,$len);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1378 $color .= preg_replace('/(.{3})./s','$1',$line);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1379 $alpha .= preg_replace('/.{3}(.)/s','$1',$line);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1380 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1381 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1382 unset($data);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1383 $data = gzcompress($color);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1384 $info['smask'] = gzcompress($alpha);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1385 $this->WithAlpha = true;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1386 if($this->PDFVersion<'1.4')
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1387 $this->PDFVersion = '1.4';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1388 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1389 $info['data'] = $data;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1390 return $info;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1391 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1392
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1393 protected function _readstream($f, $n)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1394 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1395 // Read n bytes from stream
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1396 $res = '';
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1397 while($n>0 && !feof($f))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1398 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1399 $s = fread($f,$n);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1400 if($s===false)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1401 $this->Error('Error while reading stream');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1402 $n -= strlen($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1403 $res .= $s;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1404 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1405 if($n>0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1406 $this->Error('Unexpected end of stream');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1407 return $res;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1408 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1409
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1410 protected function _readint($f)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1411 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1412 // Read a 4-byte integer from stream
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1413 $a = unpack('Ni',$this->_readstream($f,4));
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1414 return $a['i'];
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1415 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1416
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1417 protected function _parsegif($file)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1418 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1419 // Extract info from a GIF file (via PNG conversion)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1420 if(!function_exists('imagepng'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1421 $this->Error('GD extension is required for GIF support');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1422 if(!function_exists('imagecreatefromgif'))
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1423 $this->Error('GD has no GIF read support');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1424 $im = imagecreatefromgif($file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1425 if(!$im)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1426 $this->Error('Missing or incorrect image file: '.$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1427 imageinterlace($im,0);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1428 ob_start();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1429 imagepng($im);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1430 $data = ob_get_clean();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1431 imagedestroy($im);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1432 $f = fopen('php://temp','rb+');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1433 if(!$f)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1434 $this->Error('Unable to create memory stream');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1435 fwrite($f,$data);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1436 rewind($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1437 $info = $this->_parsepngstream($f,$file);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1438 fclose($f);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1439 return $info;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1440 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1441
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1442 protected function _out($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1443 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1444 // Add a line to the document
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1445 if($this->state==2)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1446 $this->pages[$this->page] .= $s."\n";
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1447 elseif($this->state==1)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1448 $this->_put($s);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1449 elseif($this->state==0)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1450 $this->Error('No page has been added yet');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1451 elseif($this->state==3)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1452 $this->Error('The document is closed');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1453 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1454
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1455 protected function _put($s)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1456 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1457 $this->buffer .= $s."\n";
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1458 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1459
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1460 protected function _getoffset()
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1461 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1462 return strlen($this->buffer);
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1463 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1464
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1465 protected function _newobj($n=null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1466 {
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1467 // Begin a new object
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1468 if($n===null)
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1469 $n = ++$this->n;
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1470 $this->offsets[$n] = $this->_getoffset();
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1471 $this->_put($n.' 0 obj');
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1472 }
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1473
a9f8de2d7b2b Fixed most charset problems. Added fpdf library. Added inventory pdf creation.
Michiel Broek <mbroek@mbse.eu>
parents: