本文整理汇总了PHP中APP::print_render方法的典型用法代码示例。如果您正苦于以下问题:PHP APP::print_render方法的具体用法?PHP APP::print_render怎么用?PHP APP::print_render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类APP
的用法示例。
在下文中一共展示了APP::print_render方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdf
private function pdf($params)
{
try {
$condition = array();
$data = array();
if (!empty($params['a']) && !empty($params['z']) && !empty($params['cdate'])) {
$col_date = $params['cdate'];
$query = sprintf("%s BETWEEN '%s' and '%s' ", $params['cdate'], $params['a'], $params['z']);
$condition['conditions'] = $query;
}
$sales = SalesApotik::all($condition);
$data["rows"] = $sales;
$data["title"] = $this->template_header;
$data["posting_range"] = sprintf(" %s sampai %s", $params['a'], $params['z']);
$data["params"] = sprintf("a=%s&z=%s&cdate=%s", $params['a'], $params['z'], "posting_date");
$data["source_url"] = APP::urlFor('selling.export');
} catch (Exception $e) {
App::flash('error', $e);
}
$paper = array("a4", "portrait");
$dompdf = APP::print_render('selling/print_laporan_harian', $data, $paper);
$pdf = $dompdf->get_canvas();
$fontMetrics = $dompdf->getFontMetrics();
// $font = $fontMetrics->getSystemFonts();
$font = $fontMetrics->getFont('helvetica');
// If verdana isn't available, we'll use sans-serif.
// if (!isset($font)) { $fontMetrics->getFont("sans-serif"); }
$size = 6;
$color = array(0, 0, 0);
$text_height = $fontMetrics->getFontHeight($font, $size);
$foot = $pdf->open_object();
$w = $pdf->get_width();
$h = $pdf->get_height();
$y = $h - 2 * $text_height - 24;
$pdf->line(16, $y, $w - 16, $y, $color, 1);
$y += $text_height;
$text = sprintf("# %s", $id);
$pdf->page_text(16, $y, $text, $font, $size, $color);
$text = "Page {PAGE_NUM} of {PAGE_COUNT}";
// Center the text
$width = $fontMetrics->getTextWidth("Page 1 of 2", $font, $size);
$pdf->page_text($w / 2 - $width / 2, $y, $text, $font, $size, $color);
$pdf->close_object();
$pdf->add_object($foot, "all");
// $watermark = $pdf->open_object();
// $pdf->set_opacity(0.87);
// $width = Font_Metrics::get_text_width("COPY", Font_Metrics::get_font("verdana", "bold"), 110);
// $pdf->text(($w / 2 - $width / 2) + 10, $h / 2, "COPY", Font_Metrics::get_font("verdana", "bold"),
// 110, array(0.98, 0.98, 0.98), 0, 13.9, -37);
// $pdf->close_object();
// $pdf->add_object($watermark, "all");
$dompdf->stream(sprintf("%s.pdf", $id), array("Attachment" => 0));
}