1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * class PDF_SPIP extends PDF : |
---|
5 | */ |
---|
6 | |
---|
7 | |
---|
8 | class PDF_SPIP extends PDF |
---|
9 | { |
---|
10 | |
---|
11 | |
---|
12 | // haut, gauche, bas, droite |
---|
13 | function SetAllMargins($TopMargin, $LeftMargin, $BottomMargin, $RightMargin) |
---|
14 | { |
---|
15 | // gauche, haut, droite |
---|
16 | $this->SetMargins($LeftMargin,$TopMargin,$RightMargin); |
---|
17 | |
---|
18 | // bas |
---|
19 | $this->SetAutoPageBreak(auto, $BottomMargin*3/2); |
---|
20 | } |
---|
21 | |
---|
22 | |
---|
23 | function Header() |
---|
24 | { |
---|
25 | global $titre ; |
---|
26 | |
---|
27 | $this->SetY($this->tMargin/2); |
---|
28 | $this->SetLineWidth(0.3); |
---|
29 | $this->Line($this->lMargin - 3, $this->tMargin, $this->w - $this->rMargin + 3, $this->tMargin); |
---|
30 | |
---|
31 | //Police helvetica gras 8 |
---|
32 | $this->SetFont('helvetica','B',12); |
---|
33 | $this->SetTextColor(0,0,0); |
---|
34 | |
---|
35 | $this->Cell(0,$this->tMargin/2, $titre ,0,0,'C'); |
---|
36 | |
---|
37 | // $this->tMargin = marge du haut, définie dans FPDF |
---|
38 | $this->Ln(9); |
---|
39 | } |
---|
40 | |
---|
41 | |
---|
42 | /* /// Pied de page du document) |
---|
43 | /* ///////////////////////////// */ |
---|
44 | function Footer() |
---|
45 | { |
---|
46 | global $conf_nom_site , $conf_url_site ; |
---|
47 | |
---|
48 | $this->SetY(-$this->bMargin/2); |
---|
49 | $this->SetLineWidth(0.3); |
---|
50 | $this->Line($this->lMargin - 3, $this->GetY(), $this->w - $this->rMargin + 3, $this->GetY()); |
---|
51 | |
---|
52 | |
---|
53 | //Police helvetica 8 |
---|
54 | $this->SetFont('helvetica','I',8); |
---|
55 | $this->SetTextColor(0,0,0); |
---|
56 | |
---|
57 | // Copyright |
---|
58 | $this->Cell(0,6,"Copyright © ".$conf_nom_site ,0,0,'L',0,$conf_url_site ); |
---|
59 | |
---|
60 | //Numéro de page |
---|
61 | $this->SetX($this->w-$this->rMargin*2-5); |
---|
62 | $this ->Cell(0,6,'Page '.$this->PageNo().'/{nb}', 0, 1, 'C'); |
---|
63 | } |
---|
64 | |
---|
65 | function GenerateTitlePage() |
---|
66 | { |
---|
67 | global $site, $rubrique, $yahoo, $surtitre, $titre, $soustitre; |
---|
68 | global $logo_site, $logo_fichier, $logo_lien; |
---|
69 | global $auteur, $descriptif; |
---|
70 | global $copyright; |
---|
71 | global $conf_url_site; |
---|
72 | global $DateParution,$DateMiseEnLigne; |
---|
73 | |
---|
74 | |
---|
75 | // En-tête |
---|
76 | if (file_exists($logo_site)) |
---|
77 | { |
---|
78 | $this->Image($logo_site,$this->rMargin+3,$this->tMargin+2,20,20); |
---|
79 | } |
---|
80 | |
---|
81 | $this->SetFont('times','',12); |
---|
82 | $this->SetXY($this->rMargin+25,$this->tMargin+6); |
---|
83 | $this->MultiCell(0,5,"Extrait du " . $site); |
---|
84 | |
---|
85 | $this->SetXY($this->rMargin+25,$this->tMargin+14); |
---|
86 | $this->PutLink($conf_url_site,$conf_url_site); |
---|
87 | |
---|
88 | |
---|
89 | //Surtitre (type du document) |
---|
90 | $this->unhtmlentities($surtitre); |
---|
91 | $this->SetXY(20,92); |
---|
92 | $this->SetFont('courier','B',14); |
---|
93 | $this->MultiCell(170,6,$surtitre,0,'C',0); |
---|
94 | |
---|
95 | |
---|
96 | //Titre centré |
---|
97 | $this->SetXY(20,100); |
---|
98 | $this->SetFont('helvetica','B',32); |
---|
99 | $this->unhtmlentities($titre); |
---|
100 | $this->MultiCell(170,20,$titre,0,'C',0); |
---|
101 | |
---|
102 | |
---|
103 | // Rubriques |
---|
104 | $this->Ln(2); |
---|
105 | $this->SetFont('helvetica','',8); |
---|
106 | $this->MultiCell(0,5,$yahoo,0,'C',0); |
---|
107 | |
---|
108 | // Logo |
---|
109 | |
---|
110 | if ($logo_fichier!="") { |
---|
111 | $x = $this->GetX(); |
---|
112 | $y = $this->GetY(); |
---|
113 | $this->SetLink($link); |
---|
114 | // $this->Image($logo_fichier,50,170,'','','','','0'); |
---|
115 | // $this->Image($logo_fichier,50-($w/2),170,50,50,'','','0'); |
---|
116 | $this->Image($logo_fichier,50-($w/2),170,'','','',$logo_lien,'0'); |
---|
117 | $this->SetXY($xi, $yi); |
---|
118 | } |
---|
119 | |
---|
120 | |
---|
121 | //Dates |
---|
122 | $this->SetFont('times','',10); |
---|
123 | |
---|
124 | if ($DateMiseEnLigne) |
---|
125 | { |
---|
126 | $this->SetXY(110,184); |
---|
127 | $DateMiseEnLigne = $this->unhtmlentities($DateMiseEnLigne); |
---|
128 | $this->MultiCell(0,6,"Date de mise en ligne : $DateMiseEnLigne",0,'L',0); |
---|
129 | } |
---|
130 | |
---|
131 | if ($DateParution) |
---|
132 | { |
---|
133 | $this->SetXY(110,190); |
---|
134 | $DateParution = $this->unhtmlentities($DateParution); |
---|
135 | $this->MultiCell(0,6,"Date de parution : $DateParution",0,'L',0); |
---|
136 | } |
---|
137 | |
---|
138 | |
---|
139 | // Descriptif |
---|
140 | if ($descriptif) |
---|
141 | { |
---|
142 | |
---|
143 | $this->SetFont('helvetica','B',10) ; |
---|
144 | $this->SetXY($this->rMargin+5,220); |
---|
145 | $this->SetFont('helvetica', 'BU', 10); |
---|
146 | $this->Write(5, 'Description :'); |
---|
147 | $this->Ln(); |
---|
148 | $this->SetFont('times', '', 8); |
---|
149 | $this->WriteHTML($descriptif,5) ; |
---|
150 | } |
---|
151 | |
---|
152 | if ($copyright) |
---|
153 | { |
---|
154 | $this->SetXY(45,250); |
---|
155 | $this->SetFont('times', 'B', 10); |
---|
156 | $this->MultiCell(120,8,$copyright,'TB','C',0); |
---|
157 | } |
---|
158 | } |
---|
159 | |
---|
160 | function GenerateText() |
---|
161 | { |
---|
162 | global $texte, $chapo, $ps, $notes ; |
---|
163 | |
---|
164 | $this->SetFont('helvetica'); |
---|
165 | if ($chapo) |
---|
166 | { |
---|
167 | // Chapeau |
---|
168 | $this->SetFont('times','B',13); |
---|
169 | $this->WriteHTML($chapo,5); |
---|
170 | $this->Ln(12); |
---|
171 | } |
---|
172 | |
---|
173 | //Texte - justifie |
---|
174 | $this->SetFont('helvetica','',10); |
---|
175 | $this->WriteHTML($texte,5); |
---|
176 | $this->Ln(12); |
---|
177 | if ($ps) |
---|
178 | { |
---|
179 | //ps |
---|
180 | $this->SetFont('','I',8); |
---|
181 | $this->WriteHTML("Post-scriptum : ",4); |
---|
182 | $this->WriteHTML($ps,4); |
---|
183 | $this->Ln(8); |
---|
184 | } |
---|
185 | if ($notes) { |
---|
186 | //notes |
---|
187 | $this->SetFont('','',8); |
---|
188 | $this->WriteHTML($notes,3); |
---|
189 | $this->Ln(); |
---|
190 | } |
---|
191 | } |
---|
192 | |
---|
193 | function BuildDocument() |
---|
194 | { |
---|
195 | $this->AddPage(); |
---|
196 | $this->GenerateTitlePage(); |
---|
197 | $this->AddPage(); |
---|
198 | $this->GenerateText(); |
---|
199 | |
---|
200 | // On repasse en police à la bonne taille pour le nombre de pages. |
---|
201 | $this->SetFont('helvetica','I',8); |
---|
202 | $this->AliasNbPages(); |
---|
203 | } |
---|
204 | // |
---|
205 | } |
---|
206 | |
---|
207 | ?> |
---|