]> wagnertech.de Git - timetracker.git/blobdiff - topdf.php
Incrementing version for the previous change
[timetracker.git] / topdf.php
index 744ef4a2a5907aa41effced4aaa76221b9b3da03..3f0a6dc758ca910b75446b37cd11ff8cc530b9ce 100644 (file)
--- a/topdf.php
+++ b/topdf.php
@@ -309,6 +309,11 @@ if ($totals_only) {
   $html .= '</tr>';
   $html .= '</table>';
 }
+
+// Output footer.
+if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false)) // By default we print it unless explicitely defined as false.
+  $html .= '<p style="text-align: center;">'.$i18n->getKey('form.mail.footer').'</p>';
+
 // By this time we have html ready.
 
 // Determine title for report.
@@ -328,7 +333,7 @@ header('Content-Disposition: attachment; filename="timesheet.pdf"');
 // Beginning of TCPDF code here.
 
 // Extend TCPDF class so that we can use custom header and footer.
-class MyyPDF extends TCPDF {
+class ttPDF extends TCPDF {
 
   public $image_file = 'images/tt_logo.png'; // Image file for the logo in header.
   public $page_word = 'Page'; // Localized "Page" word in footer, ex: Page 1/2.
@@ -354,14 +359,14 @@ class MyyPDF extends TCPDF {
     // Position at 15 mm from bottom.
     $this->SetY(-15);
     // Set font.
-    $this->SetFont('helvetica', 'I', 8);
+    $this->SetFont('freeserif', 'I', 8);
     // Print localized page number.
     $this->Cell(0, 10, $this->page_word.' '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
   }
 }
 
 // Create new PDF document.
-$pdf = new MyyPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+$pdf = new ttPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
 
 // If custom logo file exists - set it.
 if (file_exists('images/'.$user->team_id.'.png'))
@@ -369,8 +374,6 @@ if (file_exists('images/'.$user->team_id.'.png'))
 
 // Set page word for the footer.
 $pdf->SetPageWord($i18n->getKey('label.page'));
-// TODO: currently, we have problems rendering PDF in some languages such as Russian (headers, page word).
-// Not sure how to fix it... One option is to switch to mPDF - consider.
 
 // Set document information.
 $pdf->SetCreator(PDF_CREATOR);
@@ -393,8 +396,8 @@ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
 // Add a page.
 $pdf->AddPage();
 
-// Set font.
-$pdf->SetFont('helvetica', '', 10);
+// Set font (freeserif seems to work for all languages).
+$pdf->SetFont('freeserif', '', 10); // helvetica here does not work for Russian.
 
 // Write HTML.
 $pdf->writeHTML($html, true, false, false, false, '');
@@ -404,4 +407,3 @@ $pdf->writeHTML($html, true, false, false, false, '');
 $pdf->Output('timesheet.pdf', 'D'); // D is for downloads.
 
 // End of of TCPDF code.
-?>
\ No newline at end of file