Example #1
0
 function testUsageExample()
 {
     $model = new \Core3\Model\Spreadsheet();
     $model->defineColumns(array('id', 'name'));
     $model->addRow(array('1', 'kalle'));
     $model->addRow(array('2', 'olle'));
     $writer = new Pdf();
     $writer->setCreator('custom framework 1.0');
     $writer->setAuthor('Mr Cool');
     $writer->setTitle('Document title');
     $writer->setSubject('Document subject');
     $writer->addKeywords(array('cool', 'stuff', 'testing'));
     $data = $writer->render($model);
     $this->assertGreaterThan(1000, strlen($data), 'Some data was returned');
     $reader = new \Core3\Reader\BinaryData\Document();
     $this->assertEquals(true, $reader->isRecognized($data));
     $this->assertEquals(true, $reader->isPdfData($data));
 }
Example #2
0
 public function printAbstract($title = "", $vendorName, $total, $startDate, $endDate)
 {
     set_time_limit(0);
     $pdf = new Pdf("P", PDF_UNIT, "A4", true, 'UTF-8', false);
     $date = date('d-m-Y');
     $filename = $vendorName . "_" . $startDate . "_" . $endDate . "_" . $date;
     // set header and footer fonts
     // set margins
     $pdf->setTitle('');
     $pdf->Header();
     $pdf->Footer();
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT, true);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     //$pdf->SetMargins (15, 27, 15, true);
     $pdf->SetFont('times', '', 14);
     $pdf->SetAutoPageBreak(TRUE, 50);
     $pdf->AddPage();
     $pdf->Cell(0, 0, 'ENGINEERING COLLEGE HOSTELS', 0, 0, 'C');
     $pdf->Ln();
     $pdf->SetFont('times', '', 12);
     $pdf->Cell(0, 0, 'COLLEGE OF ENGINEERING, GUINDY', 0, 0, 'C');
     $pdf->Ln();
     $pdf->Cell(0, 0, 'ANNA UNIVERSITY, CHENNAI-25', 0, 0, 'C');
     $pdf->Ln();
     $pdf->SetFont('times', '', 14);
     $pdf->Cell(0, 0, 'ABSTRACT OF SUPPLIER\'S BILL', 0, 0, 'C');
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('times', '', 14);
     $text = "BILL RECEIVED FROM " . $vendorName . " FOR THE SUPPLIES MADE";
     $pdf->Cell(0, 0, $text, 0, 0, 'L');
     if ($startDate == $endDate) {
         $text = "ON " . $startDate;
     } else {
         $text = "BETWEEN " . $startDate . " AND " . $endDate;
     }
     $pdf->Ln();
     $pdf->Cell(0, 0, $text, 0, 0, 'L');
     $pdf->SetFont('times', '', 12);
     $html = "";
     //create html
     $html .= '<html><head><title>Report</title>';
     $html .= '</head><body >';
     $base_path = base_url();
     $html .= '<style>tr,th{border: 1px solid black;}</style>';
     $html .= $_POST['toSend'];
     $html .= '</body></html>';
     $pdf->writeHTML($html, false, false, false, false, '');
     $inWords = $this->convert_number($total);
     $text = "BILL PASSED FOR RUPEES " . $inWords;
     $pdf->SetFont('times', '', 14);
     $pdf->Ln();
     $pdf->Cell(0, 0, $text, 0, 0, 'L');
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $html = '<table><tr><th>Store Manager</th><th>Deputy Warden</th><th>Hostel Warden</th></tr></table>';
     $pdf->writeHTML($html, false, false, false, false, '');
     //	$pdf->Output('C:\xampp\htdocs\cegMessStore\reports\report.pdf', 'FD');  //save pdf
     if (strpos($title, "Vegetable") !== false) {
         $dir = "Vegetable Abstract/" . $filename . ".pdf";
     } else {
         $dir = "Items Abstract/" . $filename . ".pdf";
     }
     $pdf->Output("/var/www/cegMessStore/reports/" . $dir, 'FD');
     //save pdf
     //		$pdf->Output('file.pdf', 'I'); // show pdf
     return true;
 }