original_lMargin)) { $this->original_lMargin = $this->lMargin; } if (!isset($this->original_rMargin)) { $this->original_rMargin = $this->rMargin; } //set current position $this->SetXY($this->original_lMargin, $this->header_margin); if (($this->header_logo) AND ($this->header_logo != K_BLANK_IMAGE)) { $this->Image(K_PATH_IMAGES.$this->header_logo, $this->original_lMargin, $this->header_margin, $this->header_logo_width); } else { $this->img_rb_y = $this->GetY(); } $cell_height = round((K_CELL_HEIGHT_RATIO * $this->header_font[2]) / $this->k, 2); $header_x = $this->original_lMargin + ($this->header_logo_width * 1.05); //set left margin for text data cell // header title $this->SetFont($this->header_font[0], 'B', $this->header_font[2] + 1); $this->SetX($header_x); $this->Cell($this->header_width, $cell_height, $this->header_title, 0, 1, 'L'); // header string $this->SetFont($this->header_font[0], $this->header_font[1], $this->header_font[2]); $this->SetX($header_x); $this->MultiCell($this->header_width, $cell_height, $this->header_string, 0, 'L', 0); // print an ending header line if (empty($this->header_width)) { //set style for cell border $this->SetLineWidth(0.1); $this->SetDrawColor(0, 0, 0); $this->SetY(1 + max($this->img_rb_y, $this->GetY())); $this->SetX($this->original_lMargin); $this->Cell(0, 0, '', 'T', 0, 'C'); } //restore position $this->SetXY($this->original_lMargin, $this->tMargin); return $this; } /** * Renders PDF page footer * @ingroup themeable */ function theme_pdfview_pdf_footer($this) { if (!isset($this->original_lMargin)) { $this->original_lMargin = $this->lMargin; } if (!isset($this->original_rMargin)) { $this->original_rMargin = $this->rMargin; } //set font $this->SetFont($this->footer_font[0], $this->footer_font[1] , $this->footer_font[2]); //set style for cell border $line_width = 0.1; $this->SetLineWidth($line_width); $this->SetDrawColor(0, 0, 0); $footer_height = round((K_CELL_HEIGHT_RATIO * $this->footer_font[2]) / $this->k, 2); //footer height //get footer y position $footer_y = $this->h - $this->footer_margin - $footer_height; //set current position $this->SetXY($this->original_lMargin, $footer_y); //print document barcode if ($this->barcode) { $this->Ln(); $barcode_width = round(($this->w - $this->original_lMargin - $this->original_rMargin)); //max width $this->writeBarcode($this->original_lMargin, $footer_y + $line_width, $barcode_width, $footer_height - $line_width, "C128B", false, false, 2, $this->barcode); } $this->SetXY($this->original_lMargin, $footer_y); //Print page number $this->Cell(0, $footer_height, $this->l['w_page']." ".$this->PageNo().' / {nb}', 'T', 0, 'R'); return $this; } /** * Renders PDF output for a node * @ingroup themeable */ function theme_pdfview_node(&$pdf, $node) { $pdf->AddPage(); $pdf = theme('pdfview_title', $pdf, $node->title); $author = strip_tags(theme('username', $node)); $pdf = theme('pdfview_author', $pdf, $author); $pdf = theme('pdfview_published', $pdf, $node->created); if (node_hook($node, 'view')) { node_invoke($node, 'view'); } else { $node = node_prepare($node); } node_invoke_nodeapi($node, 'view'); $content = drupal_render($node->content); $content = pdfview_check_images($content); $pdf->SetFont(variable_get('pdfview_tcpdf_font_main_name', 'FreeSans'), '', variable_get('pdfview_tcpdf_font_main_size', 10)); $pdf = theme('pdfview_html', $pdf, $content); return $pdf; } /** * Renders a title * @ingroup themeable */ function theme_pdfview_title(&$pdf, $title) { $pdf->SetFont(variable_get('pdfview_tcpdf_font_main_name', 'FreeSans'), 'B', variable_get('pdfview_tcpdf_font_main_size', 10) * variable_get('pdfview_tcpdf_font_title_magnification', 1.3)); $pdf->SetLineWidth(1); $pdf = theme('pdfview_html', $pdf, $title); $pdf->Ln(5); return $pdf; } /** * Renders an author line * @ingroup themeable */ function theme_pdfview_author(&$pdf, $author) { $pdf->SetFont(variable_get('pdfview_tcpdf_font_main_name', 'FreeSans'),'BI', variable_get('pdfview_tcpdf_font_main_size', 10)); $pdf->MultiCell(0, 5, t('By @author', array('@author' => $author)), 0, 'L', 0); return $pdf; } /** * Renders a publication date * @ingroup themeable */ function theme_pdfview_published(&$pdf, $timestamp) { $published = format_date($timestamp, 'small'); $pdf->SetFont('', '', variable_get('pdfview_tcpdf_font_main_size', 10)); $pdf->MultiCell(0, 5, t('Published: @date', array('@date' => $published)), 0, 'L', 0); $pdf->Ln(5); return $pdf; } /** * Renders an HTML string to PDF * @ingroup themeable */ function theme_pdfview_html(&$pdf, $html) { $pdf->writeHTML($html, FALSE); return $pdf; }