Current code.
[capital-apms.git] / inc / classPdfBase.php
blob4365e1dd36025d5010bf7f83a23a57a5e517e71c
1 <?php
2 /**
3 * Class for producing a formatted PDF report
5 * @package apms
6 * @subpackage classPdfBase
7 * @author Andrew McMillan <andrew@catalyst.net.nz>
8 * @copyright Catalyst IT Ltd
9 * @license http://gnu.org/copyleft/gpl.html GNU GPL v2
12 class PdfPage {
13 var $width;
14 var $height;
15 var $margin_top;
16 var $margin_bottom;
17 var $margin_left;
18 var $margin_right;
19 var $paper;
21 function PdfPage( $paper = 'a4', $orientation = 'portrait' ) {
22 $this->paper = $paper;
23 switch (strtoupper($paper)){
24 case 'A0': {$width = 840; $height = 1188; break;}
25 case 'A1': {$width = 594; $height = 840; break;}
26 case 'A2': {$width = 420; $height = 594; break;}
27 case 'A3': {$width = 297; $height = 420; break;}
28 case 'A4': default: {$width = 210; $height = 297; break;}
29 case 'A5': {$width = 148.5; $height = 210; break;}
31 switch (strtolower($orientation)){
32 case 'landscape':
33 $a=$width;
34 $width=$height;
35 $height=$a;
36 break;
42 class PdfBase {
43 var $pages;
44 var $current_paper;
45 var $current_orientation;
46 var $current_page;
48 function PdfBase( $paper = 'a4', $orientation = 'portrait' ) {
49 $this->pages = array();
50 $this->current_page = -1;
51 $this->NewPage($paper,$orientation);
54 function NewPage( $paper = 'a4', $orientation = 'portrait' ) {
55 $this->pages[$this->current_page] &= new PdfPage( $paper, $orientation );
56 $this->current_paper = $paper;
57 $this->current_orientation = $orientation;