本文整理汇总了PHP中TCPDF::output方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::output方法的具体用法?PHP TCPDF::output怎么用?PHP TCPDF::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::output方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
public function download($id)
{
$book = Book::with(array('chapter' => function ($query) {
$query->orderBy('order', 'asc');
}, 'chapter.element' => function ($query) {
$query->orderBy('order', 'asc');
}))->where("id", "=", $id)->get();
$view = View::make('pdf/result', array("book" => $book));
$pdf = new TCPDF();
$pdf->AddPage();
$pdf->writeHTML($view, true, false, true, false, '');
$filename = public_path() . '/pdf/test.pdf';
$pdf->output($filename, 'F');
return Response::download($filename);
}
示例2: postAdicionar
public function postAdicionar()
{
$pdf = new TCPDF();
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('GestBiblio - Sistema de Gestão de Bibliotecas');
$pdf->SetTitle('Comprovante de Imprestimo');
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$html = '';
$pdf->Text(90, 140, 'This is a test');
$filename = storage_path() . '/test.pdf';
$pdf->output($filename, 'F');
return Response::view($filename);
}
示例3: printPost
/**
* [พิมพ์ post]
* @param [type] $id [description]
* @return [type] [description]
*/
public function printPost($id)
{
if (Session::get('c3') == 1) {
$sql = ' select c.*, concat(n.pname,n.fname," ",n.lname) as fullname from c_blog_posts c left join n_datageneral n on n.cid=c.created_by';
$sql .= ' where postID =' . e($id) . ' ';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(array('angsanaupc', '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array('angsanaupc', '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(15, 15, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->AddPage();
$pdf->SetFont('angsanaupc', 'B', 16, '', true);
$pdf->SetXY(15, 15);
$pdf->MultiCell(180, 0, 'ใบประสานงานขอรถ', 0, 'C', 0, 1, '', '', true);
$data = DB::select($sql);
$pdf->SetFont('angsanaupc', '', 14, '', true);
$tbl = '<br /><br /><table style="width: 100%; padding:2px;" cellspacing="0">';
foreach ($data as $key => $value) {
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> เรื่อง ' . $value->postTitle . '</td>
</tr>';
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> สร้างโดย ' . $value->fullname . ' วันที่ ' . date("d-m", strtotime($value->postDate)) . '-' . (date("Y", strtotime($value->postDate)) + 543) . ' เวลา ' . date("H:i:s", strtotime($value->postDate)) . '</td>
</tr>';
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> ' . $value->postDesc . '</td>
</tr>';
}
$tbl = $tbl . '</table>';
$pdf->writeHTML($tbl, true, false, false, false, '');
$filename = storage_path() . '/report_post.pdf';
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
} else {
return Redirect::to('contact');
}
}
示例4: salary_sso_pdf_export
//.........这里部分代码省略.........
$pdf->SetY(30);
$pdf->SetX(10);
$pdf->MultiCell(40, 5, 'ชื่อสถานประกอบการ ', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 13, '', true);
$pdf->SetY(30);
$pdf->SetX(50);
$pdf->MultiCell(70, 5, $name, 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', 'B', 13, '', true);
$pdf->SetY(30);
$pdf->SetX(140);
$pdf->MultiCell(22, 5, 'เลขที่บัญชี', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 13, '', true);
$pdf->SetY(30);
$pdf->SetX(163);
$pdf->MultiCell(25, 5, '1090000219', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', 'B', 13, '', true);
$pdf->SetY(36);
$pdf->SetX(140);
$pdf->MultiCell(22, 5, 'สาขา', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 13, '', true);
$pdf->SetY(36);
$pdf->SetX(163);
$pdf->MultiCell(25, 5, '300311', 0, 'L', 0, 1, '', '', true);
$linever = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
$pdf->Line(200, 43, 10, 43, $linever);
$pdf->Line(200, 50, 10, 50, $linever);
$pdf->SetFont('freeserif', '', 13, '', true);
$pdf->SetY(43);
$pdf->SetX(10);
$pdf->MultiCell(20, 7, 'ลำดับที่', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(43);
$pdf->SetX(30);
$pdf->MultiCell(40, 7, 'เลขประจำตัวประชาชน', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(43);
$pdf->SetX(70);
$pdf->MultiCell(70, 7, 'ชื่อ-สกุล', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(43);
$pdf->SetX(140);
$pdf->MultiCell(30, 7, 'ค่าจ้าง', 0, 'R', 0, 1, '', '', true);
$pdf->SetY(43);
$pdf->SetX(170);
$pdf->MultiCell(30, 7, 'เงินสมทบ', 0, 'R', 0, 1, '', '', true);
}
//end add header
//detail
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(10);
$pdf->MultiCell(20, 7, $row, 0, 'R', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(30);
$pdf->MultiCell(40, 7, $k->cid, 0, 'C', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(70);
$pdf->MultiCell(70, 7, $k->name, 0, 'L', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(140);
$pdf->MultiCell(30, 7, number_format($k->salary, 2), 0, 'R', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(170);
$pdf->MultiCell(30, 7, number_format($k->salary_sso, 2), 0, 'R', 0, 1, '', '', true);
//end detail
$sum1 = $sum1 + $k->salary;
$sum2 = $sum2 + $k->salary_sso;
$j++;
}
// end data
//sum all
$pdf->Line(200, 50 + $j * 7.5, 10, 50 + $j * 7.5, $linever);
$pdf->Line(200, 56 + $j * 7.5, 10, 57 + $j * 7.5, $linever);
$pdf->SetFont('freeserif', 'B', 13, '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(70);
$pdf->MultiCell(70, 7, 'ยอดรวม', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(140);
$pdf->MultiCell(30, 7, number_format($sum1, 2), 0, 'R', 0, 1, '', '', true);
$pdf->SetY(50 + $j * 7.5);
$pdf->SetX(170);
$pdf->MultiCell(30, 7, number_format($sum2, 2), 0, 'R', 0, 1, '', '', true);
//end sum all
//
$pdf->SetFont('freeserif', '', 13, '', true);
$pdf->SetY(62 + $j * 7.5);
$pdf->SetX(70);
$pdf->MultiCell(90, 5, 'ลงชื่อ.............................................................', 0, 'R', 0, 1, '', '', true);
$pdf->SetY(62 + $j * 7.5);
$pdf->SetX(160);
$pdf->MultiCell(43, 5, 'นายจ้าง/ผู้รับมอบอำนาจ', 0, 'R', 0, 1, '', '', true);
$pdf->SetY(70 + $j * 7.5);
$pdf->SetX(70);
$pdf->MultiCell(90, 5, '(.............................................................)', 0, 'R', 0, 1, '', '', true);
$pdf->SetY(82 + $j * 7.5);
$pdf->SetX(70);
$pdf->MultiCell(120, 5, 'ยื่นแบบวันที่.............เดือน..............................พ.ศ..............', 0, 'C', 0, 1, '', '', true);
$filename = storage_path() . '/salary_sso_pdf_export.pdf';
// Response::download($filename);
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
}
示例5: save
/**
* Save PHPExcel to file
*
* @param string $pFilename Filename for the saved file
* @throws Exception
*/
public function save($pFilename = null)
{
// garbage collect
$this->_phpExcel->garbageCollect();
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
// Open file
$fileHandle = fopen($pFilename, 'w');
if ($fileHandle === false) {
throw new Exception("Could not open file {$pFilename} for writing.");
}
// Set PDF
$this->_isPdf = true;
// Build CSS
$this->buildCSS(true);
// Generate HTML
$html = '';
//$html .= $this->generateHTMLHeader(false);
$html .= $this->generateSheetData();
//$html .= $this->generateHTMLFooter();
// Default PDF paper size
$paperSize = 'LETTER';
// Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
// Override Page Orientation
if (!is_null($this->_orientation)) {
$orientation = $this->_orientation == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
}
// Override Paper Size
if (!is_null($this->_paperSize)) {
$printPaperSize = $this->_paperSize;
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setFontSubsetting(false);
// Set margins, converting inches to points (using 72 dpi)
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
$pdf->SetAutoPageBreak(true, $printMargins->getBottom() * 72);
// $pdf->setHeaderMargin($printMargins->getHeader() * 72);
// $pdf->setFooterMargin($printMargins->getFooter() * 72);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
// Set the appropriate font
$pdf->SetFont($this->_font);
$pdf->writeHTML($html);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
// Close file
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
}
示例6: save
/**
* Save PHPExcel to file
*
* @param string $pFilename Name of the file to save as
* @throws PHPExcel_Writer_Exception
*/
public function save($pFilename = NULL)
{
$fileHandle = parent::prepareForSave($pFilename);
// Default PDF paper size
$paperSize = 'LETTER';
// Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet(0)->getPageMargins();
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
$printMargins = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageMargins();
}
// Override Page Orientation
if (!is_null($this->getOrientation())) {
$orientation = $this->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
}
// Override Paper Size
if (!is_null($this->getPaperSize())) {
$printPaperSize = $this->getPaperSize();
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setFontSubsetting(FALSE);
// Set margins, converting inches to points (using 72 dpi)
$pdf->SetMargins($printMargins->getLeft() * 72, $printMargins->getTop() * 72, $printMargins->getRight() * 72);
$pdf->SetAutoPageBreak(TRUE, $printMargins->getBottom() * 72);
$pdf->setPrintHeader(FALSE);
$pdf->setPrintFooter(FALSE);
$pdf->AddPage();
// Set the appropriate font
$pdf->SetFont($this->getFont());
$pdf->writeHTML($this->generateHTMLHeader(FALSE) . $this->generateSheetData() . $this->generateHTMLFooter());
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
parent::restoreStateAfterSave($fileHandle);
}
示例7: Output
/**
* Send the document to a given destination: string, local file or browser.
* In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br />
* The method first calls Close() if necessary to terminate the document.
* @param $name (string) The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
* @param $dest (string) Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>
* @public
* @since Moodle 1.0
* @see Close()
*/
public function Output($name = 'doc.pdf', $dest = 'I')
{
$olddebug = error_reporting(0);
$result = parent::output($name, $dest);
error_reporting($olddebug);
return $result;
}
示例8: save
/**
* Save PHPExcel to file
*
* @param string $pFileName
* @throws Exception
*/
public function save($pFilename = null)
{
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
// Open file
$fileHandle = fopen($pFilename, 'w');
if ($fileHandle === false) {
throw new Exception("Could not open file {$pFilename} for writing.");
}
// Build CSS
$this->buildCSS(true);
// Generate HTML
$html = '';
//$html .= $this->generateHTMLHeader(false);
$html .= $this->generateSheetData();
//$html .= $this->generateHTMLFooter();
// Default PDF paper size
$paperSize = 'A4';
$orientation = 'P';
// Check for overrides
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P';
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == 'landscape' ? 'L' : 'P';
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->AddPage();
$pdf->writeHTML($html);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
// Close file
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
}
示例9: tax_continuous_type4
//.........这里部分代码省略.........
$pdf->MultiCell(32, 5, 'ภาษีที่หักไว้', 0, 'L', 0, 1, '', '', true);
//============= text in content ================//
$pdf->SetFont('freeserif', '', 12, '', true);
//-----col 1
$pdf->SetY(70);
$pdf->SetX(80);
$pdf->MultiCell(30, 5, 'เงินเดือน ค่าจ้าง บำนาญ เบี้ยเลี้ยง โบนัส ตามมาตรา 40(1)', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(95);
$pdf->SetX(80);
$pdf->MultiCell(31, 5, 'เงินประจำตำแหน่ง', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(104);
$pdf->SetX(80);
$pdf->MultiCell(27, 5, 'เงินค่าตอบแทนพิเศษ พตส ค่าครองชีพ', 0, 'L', 0, 1, '', '', true);
//-----col 2
$pdf->SetY(70);
$pdf->SetX(116);
$pdf->MultiCell(31, 5, $year == 'null' ? $this->yearThai() : $year + 543, 0, 'L', 0, 1, '', '', true);
//-----col 3
$pdf->SetY(70);
$pdf->SetX(135);
$pdf->MultiCell(30, 5, number_format($key->salary, 2), 0, 'R', 0, 1, '', '', true);
$pdf->SetY(95);
$pdf->SetX(135);
$pdf->MultiCell(30, 5, number_format($key->r_c, 2), 0, 'R', 0, 1, '', '', true);
$pdf->SetY(104);
$pdf->SetX(135);
$pdf->MultiCell(30, 5, number_format($key->special, 2), 0, 'R', 0, 1, '', '', true);
//-----col 4
$pdf->SetY(70);
$pdf->SetX(165);
$pdf->MultiCell(30, 5, number_format($key->tax, 2), 0, 'R', 0, 1, '', '', true);
//============= text in box 4 footer sum ============//
$pdf->SetFont('freeserif', 'B', 13, '', true);
$pdf->SetY(182);
$pdf->SetX(89);
$pdf->MultiCell(32, 5, 'รวม', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 12, '', true);
$pdf->SetY(182);
$pdf->SetX(135);
$pdf->MultiCell(30, 5, number_format($key->salary + $key->special + $key->r_c, 2), 0, 'R', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 12, '', true);
$pdf->SetY(182);
$pdf->SetX(165);
$pdf->MultiCell(30, 5, number_format($key->tax, 2), 0, 'R', 0, 1, '', '', true);
//============= text footer ================//
$pdf->SetFont('freeserif', '', 12, '', true);
$pdf->SetY(195);
$pdf->SetX(22);
$pdf->MultiCell(32, 5, 'ผู้จ่ายเงิน', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(39);
$pdf->MultiCell(5, 5, '', 1, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(44);
$pdf->MultiCell(30, 5, '(1) หัก ณ ที่จ่าย', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(73);
$pdf->MultiCell(5, 5, '', 1, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(78);
$pdf->MultiCell(35, 5, '(2) ออกให้ตลอดไป', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(112);
$pdf->MultiCell(5, 5, '', 1, 'L', 0, 1, '', '', true);
$pdf->SetY(195);
$pdf->SetX(117);
$pdf->MultiCell(35, 5, '(3) ออกให้ครั้งเดียว', 0, 'L', 0, 1, '', '', true);
$pdf->SetY(205);
$pdf->SetX(39);
$pdf->MultiCell(5, 5, ' /', 1, 'L', 0, 1, '', '', true);
$pdf->SetY(205);
$pdf->SetX(44);
$pdf->MultiCell(100, 5, '(4) เงินสบทบกองทุนประกันสังคม ' . ' ' . number_format($key->kbk, 2) . ' บาท', 0, 'L', 0, 1, '', '', true);
$pdf->SetFont('freeserif', 'B', 12, '', true);
$pdf->SetY(220);
$pdf->SetX(18);
$pdf->MultiCell(177, 5, 'ข้าพเจ้าขอรับรองว่า ข้อความและตัวเลขดังกล่าวข้างต้นนี้ถูกต้องตามความเป็นจริงทุกประการ', 0, 'R', 0, 1, '', '', true);
$pdf->SetFont('freeserif', '', 12, '', true);
$pdf->SetY(235);
$pdf->SetX(32);
$pdf->MultiCell(170, 5, 'ลงชื่อ...........................................................ผู้มีหน้าที่หักภาษี ณ ที่จ่าย', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(245);
$pdf->SetX(32);
$pdf->MultiCell(140, 5, $director, 0, 'C', 0, 1, '', '', true);
$pdf->SetY(255);
$pdf->SetX(32);
$pdf->MultiCell(140, 5, 'ทันตแพทย์เชี่ยวชาญ ปฎิบัติราชการแทน', 0, 'C', 0, 1, '', '', true);
$pdf->SetY(265);
$pdf->SetX(32);
$pdf->MultiCell(140, 5, 'ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'C', 0, 1, '', '', true);
}
$filename = storage_path() . '/report_tax_continuous_emp4.pdf';
// Response::download($filename);
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
} else {
return View::make('login.index');
}
}
示例10: view_reserve
//.........这里部分代码省略.........
$pdf->MultiCell(20, 0, '-', 0, 'L', 0, 1, '', '', true);
}
$pdf->SetXY(10, 91 + $r);
$pdf->MultiCell(186, 0, 'ขออนุมัติเดินทางไปราชการที่.............................................................................หน่วยงานผู้จัด...............................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(50, 90 + $r);
$pdf->MultiCell(59, 0, $key->location, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(130, 90 + $r);
$pdf->MultiCell(60, 0, $key->institution, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(10, 97 + $r);
$pdf->MultiCell(186, 0, 'เรื่อง...........................................................................................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(20, 96 + $r);
$pdf->MultiCell(175, 0, $key->title, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(10, 103 + $r);
$pdf->MultiCell(187, 0, 'ตามหนังสือที่.........................................................................................................................ลงวันที่........................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(32, 102 + $r);
$pdf->MultiCell(74, 0, $key->ref_book_number, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(136, 102 + $r);
$pdf->MultiCell(50, 0, $key->ref_book_date == '0000-00-00' ? '' : $this->get_monthyearThai($key->ref_book_date), 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(10, 110 + $r);
$pdf->MultiCell(186, 0, 'ทั้งนี้ตั้งแต่วันที่.........................................................................ถึงวันที่...........................................................................รวม............................วัน', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(34, 109 + $r);
$pdf->MultiCell(55, 0, $key->startdate == '0000-00-00' ? '' : $this->get_monthyearThai($key->startdate), 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(100, 109 + $r);
$pdf->MultiCell(53, 0, $key->enddate == '0000-00-00' ? '' : $this->get_monthyearThai($key->enddate), 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(167, 109 + $r);
$pdf->MultiCell(20, 0, $key->allday, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(10, 116 + $r);
$pdf->MultiCell(186, 0, 'สำหรับค่าใช้จ่ายในการเดินทางไปราชการขอเบิกจ่ายเงินบำรุงของโรงพยาบาล และขอใช้รถยนต์เดินทางไปราชการครั้งนี้', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(20, 125 + $r);
$pdf->MultiCell(6, 0, $key->usecar1 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
$pdf->SetXY(29, 125 + $r);
$pdf->MultiCell(60, 0, 'ใช้รถยนต์ของทางโรงพยาบาลโนนไทย', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(20, 135 + $r);
$pdf->MultiCell(6, 0, $key->usecar2 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
$pdf->SetXY(29, 135 + $r);
$pdf->MultiCell(170, 0, 'ใช้รถยนต์ส่วนตัว หมายเลขทะเบียน.......................................................................ตามหลักเกณฑ์การเบิกค่า', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(84, 134 + $r);
$pdf->MultiCell(40, 0, $key->usecar2_car_number, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(29, 141 + $r);
$pdf->MultiCell(170, 0, 'ยานพาหนะส่วนตัวในการเดินทางไปราชการ กิโลเมตรละ 4 บาท เป็นเงิน................................................บาท', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(123, 140 + $r);
$pdf->MultiCell(38, 0, $key->usecar2_km_money, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(20, 149 + $r);
$pdf->MultiCell(6, 0, $key->usecar3 == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
$pdf->SetXY(29, 149 + $r);
$pdf->MultiCell(170, 0, 'อื่น ๆ (ระบุ)......................................................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(50, 148 + $r);
$pdf->MultiCell(140, 0, $key->usecar3_detail, 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(29, 158 + $r);
$pdf->MultiCell(140, 0, 'จึงเรียนมาเพื่อทราบ และโปรดพิจารณาอนุมัติด้วย จะเป็นพระคุณ', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(95, 168 + $r);
$pdf->MultiCell(100, 0, '(ลงชื่อ)...............................................................ผู้ขอ', 0, 'R', 0, 1, '', '', true);
$pdf->SetXY(122, 167 + $r);
$pdf->MultiCell(64, 0, '', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(128, 175 + $r);
$pdf->MultiCell(69, 0, '(............................................................)', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(129, 174 + $r);
$pdf->MultiCell(64, 0, $key->regis_user_req, 0, 'C', 0, 1, '', '', true);
$h_re = DB::Select('select * from n_department_header where departmentName="' . $key->department . '" ');
foreach ($h_re as $k_h) {
$header_name = $k_h->header_name;
}
if (!isset($header_name)) {
$header_name = '';
}
$pdf->SetXY(10, 186 + $r);
$pdf->MultiCell(68, 0, 'เสนอ ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(11, 194 + $r);
$pdf->MultiCell(69, 0, '...................................................', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(10, 204 + $r);
$pdf->MultiCell(90, 0, '(ลงชื่อ).........................................................หัวหน้าฝ่าย', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(18, 212 + $r);
$pdf->MultiCell(69, 0, '(.........................................................)', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(20, 211 + $r);
$pdf->MultiCell(45, 0, $header_name, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(120, 194 + $r);
$pdf->MultiCell(6, 0, $key->daytrue == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
$pdf->SetXY(123, 194 + $r);
$pdf->MultiCell(40, 0, 'ไม่เป็นวันทำการ', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(120, 204 + $r);
$pdf->MultiCell(6, 0, $key->dayflase == 1 ? '/' : '', 1, 'C', 0, 1, '', '', true);
$pdf->SetXY(123, 204 + $r);
$pdf->MultiCell(40, 0, 'เป็นวันทำการ', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(105, 219 + $r);
$pdf->MultiCell(90, 0, '(ลงชื่อ)...........................................................ผู้อนุมัติ', 0, 'R', 0, 1, '', '', true);
$pdf->SetXY(115, 227 + $r);
$pdf->MultiCell(90, 0, '( นายบุญชัย ธนบัตรชัย )', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(115, 235 + $r);
$pdf->MultiCell(90, 0, 'ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'C', 0, 1, '', '', true);
}
//end foreach
$filename = storage_path() . '/report_reserve.pdf';
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
} else {
$data = DB::table('c_req_cars')->where('godate', '>=', date('Y-m-d'))->orderBy('godate', 'asc')->paginate(10);
return View::make('home.index', array('data' => $data));
}
}
示例11: view_reqcar
//.........这里部分代码省略.........
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(28, 82);
$pdf->MultiCell(24, 0, $key->gotime_end, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(68, 82);
$pdf->MultiCell(62, 0, $key->responsible, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(166, 82);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(15, 93);
$pdf->MultiCell(70, 0, 'ระบุสถานที่ขึ้นรถ', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(15, 100);
$pdf->MultiCell(100, 0, '1.....................................................................................', 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(19, 99);
$pdf->MultiCell(70, 0, $key->upcar1, 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(15, 108);
$pdf->MultiCell(100, 0, '2.....................................................................................', 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(19, 107);
$pdf->MultiCell(70, 0, $key->upcar2, 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(15, 116);
$pdf->MultiCell(100, 0, '3.....................................................................................', 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(19, 115);
$pdf->MultiCell(70, 0, $key->upcar3, 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(95, 130);
$pdf->MultiCell(100, 0, '(ลงชื่อ)...............................................................ผู้ขออนุญาต', 0, 'R', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(110, 129);
$pdf->MultiCell(65, 0, '', 0, 'C', 0, 1, '', '', true);
//pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(118, 137);
$pdf->MultiCell(69, 0, '(..............................................................)', 0, 'C', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(120, 136);
$pdf->MultiCell(65, 0, $key->user_req, 0, 'C', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(95, 150);
$pdf->MultiCell(100, 0, '(ลงชื่อ)...............................................................หัวหน้าฝ่าย', 0, 'R', 0, 1, '', '', true);
$pdf->SetXY(118, 157);
$pdf->MultiCell(69, 0, '(............................................................)', 0, 'C', 0, 1, '', '', true);
$h_re = DB::Select('select * from n_department_header where departmentName="' . $key->department . '" ');
foreach ($h_re as $k_h) {
$header_name = $k_h->header_name;
}
if (!isset($header_name)) {
$header_name = '';
}
$pdf->SetXY(120, 156);
$pdf->MultiCell(65, 0, $header_name, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 177);
$pdf->MultiCell(180, 0, 'ความเห็นของผู้ควบคุมรถยนต์ เห็นควรอนุญาต โดยใช้รถยนต์หมายเลขทะเบียน.......................................................................................', 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(140, 176);
$pdf->MultiCell(45, 0, $key->car_number, 0, 'C', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(15, 185);
$pdf->MultiCell(180, 0, 'และให้.....................................................................................................เป็นพนักงานขับรถยนต์ ระยะทาง.................................กิโลเมตร', 0, 'L', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(28, 184);
$pdf->MultiCell(73, 0, $key->driver, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(153, 184);
$pdf->MultiCell(24, 0, $key->km_driver, 0, 'C', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(95, 200);
$pdf->MultiCell(100, 0, '(ลงชื่อ)...............................................................ผู้ควบคุม', 0, 'R', 0, 1, '', '', true);
$pdf->SetXY(121, 208);
$pdf->MultiCell(69, 0, '(................................................................)', 0, 'C', 0, 1, '', '', true);
//$pdf->SetFont('angsanaupc','',14,'',true);
$pdf->SetXY(114, 199);
$pdf->MultiCell(65, 0, '', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(121, 207);
$pdf->MultiCell(63, 0, $key->driver_control, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 220);
$pdf->MultiCell(180, 0, 'ความเห็นของผู้มีอำนาจสั่งใช้รถยนต์...............................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(15, 227);
$pdf->MultiCell(180, 0, '..........................................................................................................................................................................................................................', 0, 'L', 0, 1, '', '', true);
$pdf->SetXY(15, 227);
$pdf->MultiCell(165, 0, $key->comment, 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 245);
$pdf->MultiCell(180, 0, '(ลงชื่อ).................................................................ผู้อนุมัติ', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 252);
//$pdf->MultiCell(180, 0, '(นายบุญชัย ธนบัตรชัย)', 0, 'C', 0, 1, '', '', true);
$pdf->MultiCell(180, 0, '(นายพิศิษฐ์ สมผดุง)', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 259);
$pdf->MultiCell(180, 0, 'ทันตแพทย์เชี่ยวชาญ ปฎิบัติราชการแทน', 0, 'C', 0, 1, '', '', true);
$pdf->SetXY(15, 267);
$pdf->MultiCell(180, 0, 'ผู้อำนวยการโรงพยาบาลโนนไทย', 0, 'C', 0, 1, '', '', true);
}
$filename = storage_path() . '/report_reqcar.pdf';
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
} else {
$data = DB::table('c_req_cars')->where('godate', '>=', date('Y-m-d'))->orderBy('godate', 'asc')->paginate(10);
return View::make('home.index', array('data' => $data));
}
}
示例12: generarReporte
public function generarReporte()
{
//$this->AddPage();
parent::output($this->strUrlArchivo, 'F');
}
示例13: save
/**
* Save PHPExcel to file
*
* @param string $pFileName
* @throws Exception
*/
public function save($pFilename = null, $title = '')
{
// garbage collect
$this->_phpExcel->garbageCollect();
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType();
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
// Open file
$fileHandle = fopen($pFilename, 'w');
if ($fileHandle === false) {
throw new Exception("Could not open file {$pFilename} for writing.");
}
// Set PDF
$this->_isPdf = true;
// Build CSS
$this->buildCSS(true);
// Generate HTML
$html = '';
//$html .= $this->generateHTMLHeader(false);
if (!empty($title)) {
$html .= '<h1 align="center">' . $title . '</h1>';
}
$html .= $this->generateSheetData();
//$html .= $this->generateHTMLFooter();
// Default PDF paper size
$paperSize = 'LETTER';
// Letter (8.5 in. by 11 in.)
// Check for paper size and page orientation
if (is_null($this->getSheetIndex())) {
$orientation = $this->_phpExcel->getSheet(0)->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet(0)->getPageSetup()->getPaperSize();
} else {
$orientation = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getOrientation() == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
$printPaperSize = $this->_phpExcel->getSheet($this->getSheetIndex())->getPageSetup()->getPaperSize();
}
// Override Page Orientation
if (!is_null($this->_orientation)) {
$orientation = $this->_orientation == PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE ? 'L' : 'P';
}
// Override Paper Size
if (!is_null($this->_paperSize)) {
$printPaperSize = $this->_paperSize;
}
if (isset(self::$_paperSizes[$printPaperSize])) {
$paperSize = self::$_paperSizes[$printPaperSize];
}
// Create PDF
$pdf = new TCPDF($orientation, 'pt', $paperSize);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->AddPage();
// Set the appropriate font
require_once "../classes/Settings.php";
require_once "../classes/SettingsQuery.php";
$setQ = new SettingsQuery();
$setQ->connect();
if ($setQ->errorOccurred()) {
$setQ->close();
displayErrorPage($setQ);
}
$setQ->execSelect();
if ($setQ->errorOccurred()) {
$setQ->close();
displayErrorPage($setQ);
}
$set = $setQ->fetchRow();
$pdf->setFont($set->getFontNormal(), '', $set->getFontSize());
//$pdf->SetFont($this->_font);
$pdf->writeHTML($html);
// Document info
$pdf->SetTitle($this->_phpExcel->getProperties()->getTitle());
$pdf->SetAuthor($this->_phpExcel->getProperties()->getCreator());
$pdf->SetSubject($this->_phpExcel->getProperties()->getSubject());
$pdf->SetKeywords($this->_phpExcel->getProperties()->getKeywords());
$pdf->SetCreator($this->_phpExcel->getProperties()->getCreator());
// Write to file
fwrite($fileHandle, $pdf->output($pFilename, 'S'));
// Close file
fclose($fileHandle);
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
}
示例14: output
function output($html, $title = 'document', $pFilename = 'doc.pdf')
{
require_once '../classes/PHPExcel/Shared/PDF/tcpdf.php';
require_once "../classes/Settings.php";
require_once "../classes/SettingsQuery.php";
// Create PDF
$pdf = new TCPDF('P', 'pt', 'A4');
$pdf->SetMargins(56.7, 56.7);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setTitle($title);
$pdf->AddPage();
// Set the appropriate font
$setQ = new SettingsQuery();
$setQ->connect();
if ($setQ->errorOccurred()) {
$setQ->close();
displayErrorPage($setQ);
}
$setQ->execSelect();
if ($setQ->errorOccurred()) {
$setQ->close();
displayErrorPage($setQ);
}
$set = $setQ->fetchRow();
$pdf->setFont($set->getFontNormal());
$pdf->writeHTML($html);
$pdf->SetTitle($title);
return $pdf->output($pFilename, 'S');
}