Project

General

Profile

Defect #686 » pdf_native_test.php

Joe Privett, 09/01/2014 01:39 AM

 
1
<?
2
set_time_limit(60);
3
require_once("../library/tfpdf_table/pdfFactory.php");
4
require_once("../library/tfpdf_table/classes/pdftable.php");
5
require_once("../library/tfpdf_table/mypdf-table.php");
6

    
7

    
8
$factory = new pdfFactory();
9
$oPdf = new myPdfTable('L','mm','A4');
10
$factory->initPdfObject( $oPdf );
11
$nColumns = 6;
12
$oTable = new PdfTable( $oPdf );
13
$oTable->initialize(array(40,40,75,35,35,35));			
14

    
15

    
16
// Table Header
17
$aHeader = array();
18
for ( $i = 0; $i < $nColumns; $i++ ){
19
    $aHeader[ $i ][ 'TEXT' ] = "Header #" . ( $i + 1 );
20
}
21
$oTable->addHeader( $aHeader );
22

    
23

    
24
// Add the data rows
25
$num_rows = 33; // SETTING THIS TO 33 RUNS OK. GREATER THAN 34 CAUSES THE SCRIPT TO RUN CONTINUOUSLY.
26
for ( $j = 1; $j <= $num_rows; $j++ ){
27
	
28
    $aRow = Array();
29
	if( $j == 1 ){
30
    	$aRow[0]['ROWSPAN'] = $num_rows;
31
		$aRow[0]['TEXT'] = "Line $j Text 1";
32
	}
33
	
34
    $aRow[1]['TEXT'] = "Line $j Text 2";
35
    $aRow[2]['TEXT'] = "Line $j Text 3";
36
    $aRow[3]['TEXT'] = "Line $j Text 4";
37
    $aRow[4]['TEXT'] = "Line $j Text 5";
38
    $aRow[5]['TEXT'] = "Line $j Text 6";
39
    
40
    $oTable->addRow( $aRow );
41
}
42

    
43
//close the table
44
$oTable->close();
45

    
46

    
47
// Close report
48
$oPdf->Output();
49

    
50
?>
(5-5/5)