$pdf->ezText("\n"); } // end for complistsubtask } // end if subtask } // close task loop // add a grey bar and output the hours worked $tmp = $strings["Total_Hours_Worked"] . ": " . $sum; $pdf->transaction('start'); $ok = 0; while (!$ok) { $thisPageNum = $pdf->ezPageCount; $pdf->saveState(); $pdf->setColor(0.9, 0.9, 0.9); $pdf->filledRectangle($pdf->ez['leftMargin'], $pdf->y - $pdf->getFontHeight(12) + $pdf->getFontDecender(12), $pdf->ez['pageWidth'] - $pdf->ez['leftMargin'] - $pdf->ez['rightMargin'], $pdf->getFontHeight(12)); $pdf->restoreState(); $pdf->ezText($tmp, 12, array('justification' => 'left')); if ($pdf->ezPageCount == $thisPageNum) { $pdf->transaction('commit'); $ok = 1; } else { // then we have moved onto a new page, bad bad, as the background rectangle will be on the old one $pdf->transaction('rewind'); $pdf->ezNewPage(); } } // begin include gantt graph in pdf $pdf->ezText("\n\n"); $graphPDF = ganttPDF($reportName, $listTasks); $pdf->ezImage($graphPDF, -5, 510, "", "left");
$base_url = w2PgetConfig('base_url'); require $AppUI->getLibraryClass('ezpdf/class.ezpdf'); $pdf = new Cezpdf($paper = 'A4', $orientation = 'landscape'); $pdf->ezSetCmMargins(2, 1.5, 1.4, 1.4); //(top, bottom, left, right) /* * Define page header to be displayed on top of each page */ $pdf->saveState(); if ($skip_page) { $pdf->ezNewPage(); } $skip_page++; $page_header = $pdf->openObject(); $pdf->selectFont("{$font_dir}/Helvetica-Bold.afm"); $ypos = $pdf->ez['pageHeight'] - (30 + $pdf->getFontHeight(12)); $doc_title = strEzPdf($projects[$project_id]['project_name'], UI_OUTPUT_RAW); $pwidth = $pdf->ez['pageWidth']; $xpos = round(($pwidth - $pdf->getTextWidth(12, $doc_title)) / 2, 2); $pdf->addText($xpos, $ypos, 12, $doc_title); $pdf->selectFont("{$font_dir}/Helvetica.afm"); $date = new w2p_Utilities_Date(); $xpos = round($pwidth - $pdf->getTextWidth(10, $date->format($df)) - $pdf->ez['rightMargin'], 2); $doc_date = strEzPdf($date->format($df)); $pdf->addText($xpos, $ypos, 10, $doc_date); $pdf->closeObject($page_header); $pdf->addObject($page_header, 'all'); $gpdfkey = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_key.png'; $gpdfkeyNM = W2P_BASE_DIR . '/modules/tasks/images/ganttpdf_keyNM.png'; $pdf->ezStartPageNumbers(802, 30, 10, 'left', 'Page {PAGENUM} of {TOTALPAGENUM}'); for ($i = 0; $i < count($ganttfile); $i++) {
} for ($columnOffset = 0; $columnOffset <= 1; $columnOffset++) { $left_edge = $left_margin + $badge_width * $columnOffset + $margin; $right_edge = $left_edge + $badge_width - $margin * 2; $top_edge = $top_margin + ($offsetRow + 1) * $badge_height - $margin; $bottom_edge = $top_edge - $badge_height + $margin * 2; $center = $left_edge + ($badge_width - $margin - $base_height / 2) / 2; $logoY = $top_edge - $logo_height - $base_height * 1.5; $pdf->addPngFromFile($logo_file, $left_edge + $badge_width / 2 - $logo_width / 2 - 12, $logoY, $logo_width, $logo_height); $nameString = ucfirst($person["FIRSTNAME"]) . " " . ucfirst($person["LASTNAME"]); $nameSize = 32; while ($pdf->getTextWidth($nameSize, $nameString) > $badge_width - $margin * 4) { $nameSize -= 2; } $nameX = $center - $pdf->getTextWidth($nameSize, $nameString) / 2; $nameY = $logoY - $pdf->getFontHeight($nameSize) + 6; $pdf->addText($nameX, $nameY, $nameSize, $nameString); $institutionString = $person["INSTITUTION"]; $institutionSize = 18; // while ($pdf->getTextWidth($institutionSize, $institutionString) > 568) { // $institutionSize-=2; // } // new "guesstimated" cutoff width for resizing text while ($pdf->getTextWidth($institutionSize, $institutionString) > 300) { $institutionSize -= 2; } $institutionX = $center - $pdf->getTextWidth($institutionSize, $institutionString) / 2; $institutionY = $nameY - $pdf->getFontHeight($institutionSize); /* display shorter institutions on a single line */ if ($pdf->getTextWidth($institutionSize, $institutionString) < 234) { $pdf->addText($institutionX, $institutionY, $institutionSize, $institutionString);