1
|
<?php
|
2
|
|
3
|
require_once( 'includes/tfpdf_table/classes/pdf.php' );
|
4
|
require_once( 'includes/tfpdf_table/mypdf-table.php' );
|
5
|
require_once( 'includes/tfpdf_table/classes/pdftable.php' );
|
6
|
|
7
|
|
8
|
function prepare_data ( $string ) {
|
9
|
$string = utf8_decode( $string );
|
10
|
$string = html_entity_decode($string );
|
11
|
return $string;
|
12
|
}
|
13
|
|
14
|
function prepare_data_2 ( $string ) {
|
15
|
$string = utf8_decode( $string );
|
16
|
$string = mb_convert_encoding( $string, 'UTF-16' , 'UTF-8');
|
17
|
return $string;
|
18
|
}
|
19
|
|
20
|
|
21
|
|
22
|
$oPdf = new myPDF();
|
23
|
$oPdf->Open();
|
24
|
$oPdf->SetAutoPageBreak(true, 20);
|
25
|
$oPdf->SetMargins(20, 20, 20);
|
26
|
|
27
|
$oPdf->SetFont('arial', '', 7);
|
28
|
|
29
|
$oPdf->AddPage();
|
30
|
$oPdf->AliasNbPages();
|
31
|
|
32
|
$oTable = new Pdf_Table($oPdf);
|
33
|
$oTable->SetStyle( "p", "arial", "", 7, "130,0,30" );
|
34
|
$oTable->SetStyle( "b", "arial", "B", 7, "130,0,30" );
|
35
|
|
36
|
$examples = array();
|
37
|
$examples[] = "LariFari 123";
|
38
|
|
39
|
$examples[] = "äöü";
|
40
|
$examples[] = "ä ö ü";
|
41
|
|
42
|
foreach ( $examples AS $text ) {
|
43
|
|
44
|
$oPdf->Ln( 2 );
|
45
|
$oPdf->Cell( 0, 0, 'original: ' . $text );
|
46
|
$oPdf->Ln( 2 );
|
47
|
$oPdf->Cell( 0, 0, 'after preparing_1: ' . prepare_data($text) );
|
48
|
$oPdf->Ln( 2 );
|
49
|
$oPdf->Cell( 0, 0, 'after preparing_2: ' . prepare_data_2($text) );
|
50
|
$oPdf->Ln( 2 );
|
51
|
|
52
|
$cols = array ( '150' );
|
53
|
$oTable->initialize( $cols );
|
54
|
$oTable->addHeader( array ( array ( 'TEXT' => $text , 'COLSPAN' => count($cols) ) ) );
|
55
|
$oTable->addRow ( array ( array ( 'TEXT' => 'original: ' . $text , 'TEXT_ALIGN' => 'L' ) ) );
|
56
|
$oTable->addRow ( array ( array ( 'TEXT' => 'after preparing_1: ' . prepare_data($text) , 'TEXT_ALIGN' => 'L' ) ) );
|
57
|
$oTable->addRow ( array ( array ( 'TEXT' => 'after preparing_2: ' . prepare_data_2($text) , 'TEXT_ALIGN' => 'L' ) ) );
|
58
|
$oTable->close();
|
59
|
|
60
|
}
|
61
|
|
62
|
$oPdf->Output( 'test.pdf', 'I' );
|
63
|
|
64
|
?>
|