posaune
[timetracker.git] / topdf.php
1 <?php
2 // +----------------------------------------------------------------------+
3 // | Anuko Time Tracker
4 // +----------------------------------------------------------------------+
5 // | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
6 // +----------------------------------------------------------------------+
7 // | LIBERAL FREEWARE LICENSE: This source code document may be used
8 // | by anyone for any purpose, and freely redistributed alone or in
9 // | combination with other software, provided that the license is obeyed.
10 // |
11 // | There are only two ways to violate the license:
12 // |
13 // | 1. To redistribute this code in source form, with the copyright
14 // |    notice or license removed or altered. (Distributing in compiled
15 // |    forms without embedded copyright notices is permitted).
16 // |
17 // | 2. To redistribute modified versions of this code in *any* form
18 // |    that bears insufficient indications that the modifications are
19 // |    not the work of the original author(s).
20 // |
21 // | This license applies to this document only, not any other software
22 // | that it may be combined with.
23 // |
24 // +----------------------------------------------------------------------+
25 // | Contributors:
26 // | https://www.anuko.com/time_tracker/credits.htm
27 // +----------------------------------------------------------------------+
28
29 /*
30  * This file generates a report in PDF format using TCPDF library from http://www.tcpdf.org/.
31  * If installed, it is expected to be in WEB-INF/lib/tcpdf/ folder.
32  */
33 require_once('initialize.php');
34 import('ttConfigHelper');
35 import('form.Form');
36 import('form.ActionForm');
37 import('ttReportHelper');
38
39 // Access checks.
40 if (!(ttAccessAllowed('view_own_reports') || ttAccessAllowed('view_reports') || ttAccessAllowed('view_all_reports') || ttAccessAllowed('view_client_reports'))) {
41   header('Location: access_denied.php');
42   exit();
43 }
44 // End of access checks.
45
46 // Check whether TCPDF library is available.
47 if (!file_exists('WEB-INF/lib/tcpdf/'))
48   die('TCPDF library is not found in WEB-INF/lib/tcpdf/');
49
50 // Include TCPDF library.
51 require_once('WEB-INF/lib/tcpdf/tcpdf.php');
52
53 // Use custom fields plugin if it is enabled.
54 if ($user->isPluginEnabled('cf')) {
55   require_once('plugins/CustomFields.class.php');
56   $custom_fields = new CustomFields();
57 }
58
59 // Report settings are stored in session bean before we get here.
60 $bean = new ActionForm('reportBean', new Form('reportForm'), $request);
61
62 $config = new ttConfigHelper($user->getConfig());
63 $show_note_column = $bean->getAttribute('chnote') && !$config->getDefinedValue('report_note_on_separate_row');
64 $show_note_row = $bean->getAttribute('chnote') && $config->getDefinedValue('report_note_on_separate_row');
65
66 // There are 2 variations of report: totals only, or normal. Totals only means that the report
67 // is grouped by either date, user, client, project, task or cf_1 and user only needs to see subtotals by group.
68 $totals_only = ($bean->getAttribute('chtotalsonly') == '1');
69
70 // Obtain items for report.
71 $options = ttReportHelper::getReportOptions($bean);
72 $grouping = ttReportHelper::grouping($options);
73 if (!$totals_only)
74   $items = ttReportHelper::getItems($options); // Individual entries.
75 if ($totals_only || $grouping)
76   $subtotals = ttReportHelper::getSubtotals($options); // Subtotals for groups of items.
77 $totals = ttReportHelper::getTotals($options); // Totals for the entire report.
78
79 // Assign variables that are used to print subtotals.
80 if ($items && $grouping) {
81   $print_subtotals = true;
82   $first_pass = true;
83   $prev_grouped_by = '';
84   $cur_grouped_by = '';
85 }
86
87 // Build a string to use as filename for the files being downloaded.
88 $filename = strtolower($i18n->get('title.report')).'_'.$bean->mValues['start_date'].'_'.$bean->mValues['end_date'];
89
90 // Start preparing HTML to build PDF from.
91 $styleHeader = 'style="background-color:#a6ccf7;"';
92 $styleSubtotal = 'style="background-color:#e0e0e0;"';
93 $styleCentered = 'style="text-align:center;"';
94 $styleRightAligned = 'style="text-align:right;"';
95
96 $title = $i18n->get('title.report').": ".$totals['start_date']." - ".$totals['end_date'];
97 $html = '<h1 style="text-align:center;">'.$title.'</h1>';
98 $html .= '<table border="1" cellpadding="3" cellspacing="0" width="100%">';
99
100 if ($totals_only) {
101   // We are building a "totals only" report with only subtotals and total.
102   $group_by_header = ttReportHelper::makeGroupByHeader($options);
103   $colspan = 1; // Column span for an empty row.
104   // Table header.
105   $html .= '<thead>';
106   $html .= "<tr $styleHeader>";
107   $html .= '<td>'.htmlspecialchars($group_by_header).'</td>';
108   if ($bean->getAttribute('chduration')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.duration').'</td>'; }
109   if ($bean->getAttribute('chunits')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.work_units_short').'</td>'; }
110   if ($bean->getAttribute('chcost')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.cost').'</td>'; }
111   $html .= '</tr>';
112   $html .= '</thead>';
113   // Print subtotals.
114   foreach ($subtotals as $subtotal) {
115     $html .= '<tr>';
116     $html .= '<td>'.htmlspecialchars($subtotal['name']).'</td>';
117     if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$subtotal['time'].'</td>';
118     if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$subtotal['units'].'</td>';
119     if ($bean->getAttribute('chcost')) {
120       $html .= "<td $styleRightAligned>";
121       if ($user->can('manage_invoices') || $user->isClient())
122         $html .= $subtotal['cost'];
123       else
124         $html .= $subtotal['expenses'];
125       $html .= '</td>'; 
126     }
127     $html .= '</tr>';
128   }
129   // Print totals.
130   $html .= '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>';
131   $html .= "<tr $styleSubtotal>";
132   $html .= '<td>'.$i18n->get('label.total').'</td>';
133   if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$totals['time'].'</td>';
134   if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$totals['units'].'</td>';
135   if ($bean->getAttribute('chcost')) {
136       $html .= "<td $styleRightAligned>";
137       $html .= htmlspecialchars($user->currency).' ';
138       if ($user->can('manage_invoices') || $user->isClient())
139         $html .= $totals['cost'];
140       else
141         $html .= $totals['expenses'];
142       $html .= '</td>';
143     }
144   $html .= '</tr>';
145   $html .= '</table>';
146 } else {
147   // We are building a normal report with items, optionally grouped with subtotals, and total.
148   $colspan = 1; // Column span for an empty row.
149   // Table header.
150   $html .= '<thead>';
151   $html .= "<tr $styleHeader>";
152   $html .= '<td>'.$i18n->get('label.date').'</td>';
153   if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { $colspan++; $html .= '<td>'.$i18n->get('label.user').'</td>'; }
154   if ($bean->getAttribute('chclient')) { $colspan++; $html .= '<td>'.$i18n->get('label.client').'</td>'; }
155   if ($bean->getAttribute('chproject')) { $colspan++; $html .= '<td>'.$i18n->get('label.project').'</td>'; }
156   if ($bean->getAttribute('chtask')) { $colspan++; $html .= '<td>'.$i18n->get('label.task').'</td>'; }
157   if ($bean->getAttribute('chcf_1')) { $colspan++; $html .= '<td>'.htmlspecialchars($custom_fields->fields[0]['label']).'</td>'; }
158   if ($bean->getAttribute('chstart')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.start').'</td>'; }
159   if ($bean->getAttribute('chfinish')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.finish').'</td>'; }
160   if ($bean->getAttribute('chduration')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.duration').'</td>'; }
161   if ($bean->getAttribute('chunits')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.work_units_short').'</td>'; }
162   if ($show_note_column) { $colspan++; $html .= '<td>'.$i18n->get('label.note').'</td>'; }
163   if ($bean->getAttribute('chcost')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.cost').'</td>'; }
164   if ($bean->getAttribute('chapproved')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.approved').'</td>'; }
165   if ($bean->getAttribute('chpaid')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.paid').'</td>'; }
166   if ($bean->getAttribute('chip')) { $colspan++; $html .= "<td $styleCentered>".$i18n->get('label.ip').'</td>'; }
167   if ($bean->getAttribute('chinvoice')) { $colspan++; $html .= '<td>'.$i18n->get('label.invoice').'</td>'; }
168   if ($bean->getAttribute('chtimesheet')) { $colspan++; $html .= '<td>'.$i18n->get('label.timesheet').'</td>'; }
169   $html .= '</tr>';
170   $html .= '</thead>';
171
172   foreach ($items as $item) {
173     // Print a subtotal for a block of grouped values.
174     $cur_date = $item['date'];
175     if ($print_subtotals) {
176       $cur_grouped_by = $item['grouped_by'];
177       if ($cur_grouped_by != $prev_grouped_by && !$first_pass) {
178         $html .= '<tr style="background-color:#e0e0e0;">';
179         $html .= '<td>'.$i18n->get('label.subtotal').'</td>';
180         if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
181             $html .= '<td>';
182             $html .= htmlspecialchars($subtotals[$prev_grouped_by]['user']);
183             $html .= '</td>';
184         }
185         if ($bean->getAttribute('chclient')) {
186             $html .= '<td>';
187             $html .= htmlspecialchars($subtotals[$prev_grouped_by]['client']);
188             $html .= '</td>';
189         }
190         if ($bean->getAttribute('chproject')) {
191             $html .= '<td>';
192             $html .= htmlspecialchars($subtotals[$prev_grouped_by]['project']);
193             $html .= '</td>';
194         }
195         if ($bean->getAttribute('chtask')) {
196             $html .= '<td>';
197             $html .= htmlspecialchars($subtotals[$prev_grouped_by]['task']);
198             $html .= '</td>';
199         }
200         if ($bean->getAttribute('chcf_1')) {
201             $html .= '<td>';
202             $html .= htmlspecialchars($subtotals[$prev_grouped_by]['cf_1']);
203             $html .= '</td>';
204         }
205         if ($bean->getAttribute('chstart')) $html .= '<td></td>';
206         if ($bean->getAttribute('chfinish')) $html .= '<td></td>';
207         if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$subtotals[$prev_grouped_by]['time'].'</td>';
208         if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$subtotals[$prev_grouped_by]['units'].'</td>';
209         if ($show_note_column) $html .= '<td></td>';
210         if ($bean->getAttribute('chcost')) {
211           $html .= "<td $styleRightAligned>";
212           if ($user->can('manage_invoices') || $user->isClient())
213             $html .= $subtotals[$prev_grouped_by]['cost'];
214           else
215             $html .= $subtotals[$prev_grouped_by]['expenses'];
216           $html .= '</td>';
217         }
218         if ($bean->getAttribute('chapproved')) $html .= '<td></td>';
219         if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
220         if ($bean->getAttribute('chip')) $html .= '<td></td>';
221         if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
222         if ($bean->getAttribute('chtimesheet')) $html .= '<td></td>';
223         $html .= '</tr>';
224         $html .= '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>';
225         // TODO: page breaks on PDF reports is a rarely used feature.
226         // Currently without configuration capability.
227         // Consider adding an option to user profile instead.
228         if (isTrue('PDF_REPORT_PAGE_BREAKS')) {
229           import('ttUserConfig');
230           $uc = new ttUserConfig();
231           $use_breaks = $uc->getValue(SYSC_PDF_REPORT_PAGE_BREAKS);
232           if ($use_breaks) $html .= '<br pagebreak="true"/>';
233         }
234       }
235       $first_pass = false;
236     }
237
238     // Print a regular row.
239     $html .= '<tr>';
240     $html .= '<td>'.$item['date'].'</td>';
241     if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td>'.htmlspecialchars($item['user']).'</td>';
242     if ($bean->getAttribute('chclient')) $html .= '<td>'.htmlspecialchars($item['client']).'</td>';
243     if ($bean->getAttribute('chproject')) $html .= '<td>'.htmlspecialchars($item['project']).'</td>';
244     if ($bean->getAttribute('chtask')) $html .= '<td>'.htmlspecialchars($item['task']).'</td>';
245     if ($bean->getAttribute('chcf_1')) $html .= '<td>'.htmlspecialchars($item['cf_1']).'</td>';
246     if ($bean->getAttribute('chstart')) $html .= "<td $styleRightAligned>".$item['start'].'</td>';
247     if ($bean->getAttribute('chfinish')) $html .= "<td $styleRightAligned>".$item['finish'].'</td>';
248     if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$item['duration'].'</td>';
249     if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$item['units'].'</td>';
250     if ($show_note_column) $html .= '<td>'.htmlspecialchars($item['note']).'</td>';
251     if ($bean->getAttribute('chcost')) {
252       $html .= "<td $styleRightAligned>";
253       if ($user->can('manage_invoices') || $user->isClient())
254         $html .= $item['cost'];
255       else
256         $html .= $item['expense'];
257       $html .= '</td>';
258     }
259     if ($bean->getAttribute('chapproved')) {
260         $html .= '<td>';
261         $html .= $item['approved'] == 1 ? $i18n->get('label.yes') : $i18n->get('label.no');
262         $html .= '</td>';
263     }
264     if ($bean->getAttribute('chpaid')) {
265         $html .= '<td>';
266         $html .= $item['paid'] == 1 ? $i18n->get('label.yes') : $i18n->get('label.no');
267         $html .= '</td>';
268     }
269     if ($bean->getAttribute('chip')) {
270         $html .= '<td>';
271         $html .= $item['modified'] ? $item['modified_ip'].' '.$item['modified'] : $item['created_ip'].' '.$item['created'];
272         $html .= '</td>';
273     }
274     if ($bean->getAttribute('chinvoice')) $html .= '<td>'.htmlspecialchars($item['invoice']).'</td>';
275     if ($bean->getAttribute('chtimesheet')) $html .= '<td>'.htmlspecialchars($item['timesheet_name']).'</td>';
276     $html .= '</tr>';
277
278     if ($show_note_row && $item['note']) {
279       $html .= '<tr>';
280       $html .= "<td $styleRightAligned>".$i18n->get('label.note').'</td>';
281       $noteSpan = $colspan-1;
282       $html .= '<td colspan="'.$noteSpan.'">'.htmlspecialchars($item['note']).'</td>';
283       $html .= '</tr>';
284     }
285
286     $prev_date = $item['date'];
287     if ($print_subtotals) $prev_grouped_by = $item['grouped_by'];
288   }
289
290   // Print a terminating subtotal.
291   if ($print_subtotals) {
292     $html .= '<tr style="background-color:#e0e0e0;">';
293     $html .= '<td>'.$i18n->get('label.subtotal').'</td>';
294     if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
295       $html .= '<td>';
296       $html .= htmlspecialchars($subtotals[$prev_grouped_by]['user']);
297       $html .= '</td>';
298     }
299     if ($bean->getAttribute('chclient')) {
300       $html .= '<td>';
301       $html .= htmlspecialchars($subtotals[$prev_grouped_by]['client']);
302       $html .= '</td>';
303     }
304     if ($bean->getAttribute('chproject')) {
305       $html .= '<td>';
306       $html .= htmlspecialchars($subtotals[$prev_grouped_by]['project']);
307       $html .= '</td>';
308     }
309     if ($bean->getAttribute('chtask')) {
310       $html .= '<td>';
311       $html .= htmlspecialchars($subtotals[$prev_grouped_by]['task']);
312       $html .= '</td>';
313     }
314     if ($bean->getAttribute('chcf_1')) {
315       $html .= '<td>';
316       $html .= htmlspecialchars($subtotals[$prev_grouped_by]['cf_1']);
317       $html .= '</td>';
318     }
319     if ($bean->getAttribute('chstart')) $html .= '<td></td>';
320     if ($bean->getAttribute('chfinish')) $html .= '<td></td>';
321     if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$subtotals[$prev_grouped_by]['time'].'</td>';
322     if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$subtotals[$prev_grouped_by]['units'].'</td>';
323     if ($show_note_column) $html .= '<td></td>';
324     if ($bean->getAttribute('chcost')) {
325       $html .= "<td $styleRightAligned>";
326       if ($user->can('manage_invoices') || $user->isClient())
327         $html .= $subtotals[$prev_grouped_by]['cost'];
328       else
329         $html .= $subtotals[$prev_grouped_by]['expenses'];
330       $html .= '</td>';
331     }
332     if ($bean->getAttribute('chapproved')) $html .= '<td></td>';
333     if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
334     if ($bean->getAttribute('chip')) $html .= '<td></td>';
335     if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
336     if ($bean->getAttribute('chtimesheet')) $html .= '<td></td>';
337     $html .= '</tr>';
338   }
339
340   // Print totals.
341   $html .= '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>';
342   $html .= '<tr style="background-color:#e0e0e0;">';
343   $html .= '<td>'.$i18n->get('label.total').'</td>';
344   if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td></td>';
345   if ($bean->getAttribute('chclient')) $html .= '<td></td>';
346   if ($bean->getAttribute('chproject')) $html .= '<td></td>';
347   if ($bean->getAttribute('chtask')) $html .= '<td></td>';
348   if ($bean->getAttribute('chcf_1')) $html .= '<td></td>';
349   if ($bean->getAttribute('chstart')) $html .= '<td></td>';
350   if ($bean->getAttribute('chfinish')) $html .= '<td></td>';
351   if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$totals['time'].'</td>';
352   if ($bean->getAttribute('chunits')) $html .= "<td $styleRightAligned>".$totals['units'].'</td>';
353   if ($show_note_column) $html .= '<td></td>';
354   if ($bean->getAttribute('chcost')) {
355     $html .= "<td $styleRightAligned>".htmlspecialchars($user->currency).' ';
356     if ($user->can('manage_invoices') || $user->isClient())
357       $html .= $totals['cost'];
358     else
359       $html .= $totals['expenses'];
360     $html .= '</td>';
361   }
362   if ($bean->getAttribute('chapproved')) $html .= '<td></td>';
363   if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
364   if ($bean->getAttribute('chip')) $html .= '<td></td>';
365   if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
366   if ($bean->getAttribute('chtimesheet')) $html .= '<td></td>';
367   $html .= '</tr>';
368   $html .= '</table>';
369 }
370
371 // Output footer.
372 if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false)) // By default we print it unless explicitely defined as false.
373   $html .= '<p style="text-align: center;">'.$i18n->get('form.mail.footer').'</p>';
374
375 // By this time we have html ready.
376
377 // Determine title for report.
378 $title = $i18n->get('title.report').": ".$totals['start_date']." - ".$totals['end_date'];
379
380 header('Pragma: public'); // This is needed for IE8 to download files over https.
381 header('Content-Type: text/html; charset=utf-8');
382 header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
383 header('Cache-Control: no-store, no-cache, must-revalidate');
384 header('Cache-Control: post-check=0, pre-check=0', false);
385 header('Cache-Control: private', false);
386
387 header('Content-Type: application/pdf');
388 header('Content-Disposition: attachment; filename="'.$filename.'.pdf"');
389
390
391 // Beginning of TCPDF code here.
392
393 // Extend TCPDF class so that we can use custom header and footer.
394 class ttPDF extends TCPDF {
395
396   public $image_file = 'images/tt_logo.png'; // Image file for the logo in header.
397   public $page_word = 'Page'; // Localized "Page" word in footer, ex: Page 1/2.
398
399   // SetImageFile - sets image file name.
400   public function SetImageFile($imgFile) {
401     $this->image_file = $imgFile;
402   }
403
404   // SetPageWord - sets page word for footer.
405   public function SetPageWord($pageWord) {
406     $this->page_word = $pageWord;
407   }
408
409   // Page header.
410   public function Header() {
411     // Print logo, which is the only element of our custom header.
412     $this->Image($this->image_file, 10, 10, '', '', '', '', 'T', false, 300, 'C', false, false, 0, false, false, false);
413   }
414
415   // Page footer.
416   public function Footer() {
417     // Position at 15 mm from bottom.
418     $this->SetY(-15);
419     // Set font.
420     $this->SetFont('freeserif', 'I', 8);
421     // Print localized page number.
422     $this->Cell(0, 10, $this->page_word.' '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
423   }
424 }
425
426 // Create new PDF document.
427 $pdf = new ttPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
428
429 // If custom logo file exists - set it.
430 if (file_exists('images/'.$user->group_id.'.png'))
431   $pdf->SetImageFile('images/'.$user->group_id.'.png');
432
433 // Set page word for the footer.
434 $pdf->SetPageWord($i18n->get('label.page'));
435
436 // Set document information.
437 $pdf->SetCreator(PDF_CREATOR);
438 $pdf->SetAuthor('Anuko Time Tracker');
439 $pdf->SetTitle('Anuko Time Tracker Report');
440 $pdf->SetSubject('Anuko Time Tracker Report');
441 $pdf->SetKeywords('Anuko, time, tracker, report');
442
443 // Set margins.
444 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
445 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
446 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
447
448 // Set auto page breaks.
449 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
450
451 // Set image scale factor.
452 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
453
454 // Add a page.
455 $pdf->AddPage();
456
457 // Set font (freeserif seems to work for all languages).
458 $pdf->SetFont('freeserif', '', 10); // helvetica here does not work for Russian.
459
460 // Write HTML.
461 $pdf->writeHTML($html, true, false, false, false, '');
462
463 // Close and output PDF document.
464 // $pdf->Output('timesheet.pdf', 'I'); // This will display inline in browser.
465 $pdf->Output($filename.'.pdf', 'D'); // D is for downloads.
466
467 // End of of TCPDF code.