本文整理汇总了PHP中TCPDF类的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF类的具体用法?PHP TCPDF怎么用?PHP TCPDF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TCPDF类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Generates Pdf from html
*
* @return string raw pdf data
*/
public function output()
{
//TCPDF often produces a whole bunch of errors, although there is a pdf created when debug = 0
//Configure::write('debug', 0);
$TCPDF = new \TCPDF($this->_Pdf->orientation(), 'mm', $this->_Pdf->pageSize());
$TCPDF->AddPage();
$TCPDF->writeHTML($this->_Pdf->html());
return $TCPDF->Output('', 'S');
}
开发者ID:ceeram,项目名称:cakepdf,代码行数:14,代码来源:TcpdfEngine.php
示例2: __construct
function __construct()
{
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$this->pdf = $pdf;
$this->widths = new stdClass();
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(false);
$pdf->AddPage();
}
开发者ID:RodrigoBattagliero,项目名称:Cifras,代码行数:10,代码来源:TableWriterPDF.php
示例3: loadPdf
function loadPdf($article_id)
{
$this->load->library('pdf');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// Add a page
$pdf->AddPage();
// $html = '<div class="col-lg-12"> <h1 class="page-header">News</h1></div>';
//$data['article'] = $this->articles->get_article($article_id);
//$html= $this->load->view('output_pdf', $data);
$data = $this->articles->get_article($article_id);
$html = '<body style="height: 100%;margin-bottom: 30px;"><div style="height: 30px;">News<br/>Title:' . $data['title'] . '</div><div id="content"><center><img src="./././images/' . $data['photo'] . '"' . 'width="100" height="150" align="center"></center><br/>' . $data['text'] . '[</div><div style="height: 30px;position: absolute;
bottom: 0;">[Author Name]:' . $data['user_name'] . '- [TimeStamp]:' . $data['curr_time'] . '</div>';
$pdf->writeHTML($html, true, false, true, false, '');
ob_clean();
$pdf->Output('news_001.pdf', 'I');
}
开发者ID:jawad2007,项目名称:news_portal,代码行数:16,代码来源:pdfexample.php
示例4: getPageContentHeight
/**
* Returns the usable page height, which is the page height without top and bottom margin.
*
* @param \TCPDF $pdf
* @param int $page
* @return float
*/
public static function getPageContentHeight(\TCPDF $pdf, $page)
{
// get total height of the page in user units
$totalHeight = $pdf->getPageHeight($page) / $pdf->getScaleFactor();
$margin = $pdf->getMargins();
return $totalHeight - $margin['bottom'] - $margin['top'];
}
开发者ID:naitsirch,项目名称:tcpdf-extension,代码行数:14,代码来源:Helper.php
示例5: __construct
public function __construct(TCPDF $pdf, $title, $slogan, $name, $details)
{
$pdf->SetTextColor(255, 255, 255);
$pdf->SetFont('league-gothic', '', 100, '', true);
$pdf->writeHTMLCell(200, 200, 18, 35, $this->buildHTML('h1', $title), 0, 1, 0);
$pdf->SetFont('league-gothic', '', 70, '', true);
$pdf->writeHTMLCell(80, 200, 130, 135, $this->buildHTML('p', $slogan, 80), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-ExtraBold', '', 25, '', true);
$pdf->writeHTMLCell(120, 100, 18, 241, $this->buildHTML('h2', $name, 30), 0, 1, 0);
$pdf->SetFont('AlegreyaSans-Regular', '', 16, '', true);
$pdf->writeHTMLCell(175, 100, 18, 254, $this->buildHTML('p', $details, 20), 0, 1, 0);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:12,代码来源:connie-this-girl-can.class.php
示例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);
}
开发者ID:sisinduku,项目名称:StarTrek,代码行数:55,代码来源:tcPDF.php
示例7: 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);
}
开发者ID:spark942,项目名称:supinternet-projects,代码行数:15,代码来源:PdfController.php
示例8: __construct
/**
* Initialize
*
*/
function __construct($params = array())
{
$orientation = 'P';
$unit = 'mm';
$format = 'A4';
$unicode = true;
$encoding = 'UTF-8';
$diskcache = false;
if (isset($params['orientation'])) {
$orientation = $params['orientation'];
}
if (isset($params['unit'])) {
$unit = $params['unit'];
}
if (isset($params['format'])) {
$format = $params['format'];
}
if (isset($params['encoding'])) {
$encoding = $params['encoding'];
}
if (isset($params['diskcache'])) {
$diskcache = $params['diskcache'];
}
# initialize TCPDF
parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache);
}
开发者ID:masaru-nemoto-biz,项目名称:AiuProject,代码行数:30,代码来源:pdf.php
示例9: initPdf
/**
* initPdf - initialize TCPDF with current setting
*
* @return void
*/
private function initPdf()
{
if (empty($this->pdfEngine)) {
$this->pdfEngine = new TCPDF($this->pageOrientation, $this->unit, $this->pageSize, true, 'UTF-8', false);
if (isset($this->pdfAuthor)) {
$this->pdfEngine->SetAuthor($this->pdfAuthor);
}
if (isset($this->pdfTitle)) {
$this->pdfEngine->SetTitle($this->pdfTitle);
}
if (isset($this->pdfSubject)) {
$this->pdfEngine->SetSubject($this->pdfSubject);
}
if (isset($this->pdfKeywords)) {
$keywords = is_array($this->pdfKeywords) ? implode(', ', $this->pdfKeywords) : (string) $this->pdfKeywords;
$this->pdfEngine->SetKeywords($keywords);
}
if (!empty($this->pdfCreator)) {
$this->pdfEngine->SetCreator($this->pdfCreator);
}
if (!empty($this->fontFamily)) {
$this->pdfEngine->SetFont($this->fontFamily, $this->fontStyle, $this->fontSize);
}
if (!empty($this->monoFontFamily)) {
$this->pdfEngine->SetDefaultMonospacedFont($this->monoFontFamily);
}
if (!empty($this->leftMargin)) {
$this->pdfEngine->SetMargins($this->leftMargin, $this->topMargin, $this->rightMargin);
}
if (empty($this->bottomMargin)) {
$this->bottomMargin = PDF_MARGIN_BOTTOM;
}
$this->pdfEngine->SetAutoPageBreak(true, $this->bottomMargin);
}
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:40,代码来源:HtmlToPdfProvider.php
示例10: _getxobjectdict
/**
* Return XObjects Dictionary.
*
* Overwritten to add additional XObjects to the resources dictionary of TCPDF
*
* @return string
*/
protected function _getxobjectdict()
{
$out = parent::_getxobjectdict();
foreach ($this->_tpls as $tplIdx => $tpl) {
$out .= sprintf('%s%d %d 0 R', $this->tplPrefix, $tplIdx, $tpl['n']);
}
return $out;
}
开发者ID:shark0der,项目名称:FPDI-TCPDF,代码行数:15,代码来源:fpdi_bridge.php
示例11: pdfSetup
function pdfSetup()
{
$pdf = new TCPDF("P", "in", "Letter", true, 'UTF-8', false);
// set document information
$pdf->SetCreator("ChapR Order Processing System");
$pdf->SetAuthor('The ChapR');
$pdf->SetTitle('Packing List');
$pdf->SetSubject('Order Packing List');
$pdf->SetKeywords('ChapR, order');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetAutoPageBreak(true, 0);
$pdf->SetMargins(0, 0, 0, 0, true);
$pdf->SetFont('helvetica', '', 14, '', true);
$pdf->AddPage();
return $pdf;
}
开发者ID:ChapResearch,项目名称:Online-Orders-Database,代码行数:18,代码来源:packingListPDF.php
示例12: __construct
/**
*
*
* @param string $orientation
* @param string $unit
* @param string $format
* @param bool|true $unicode
* @param string $encoding
* @param bool|false $diskcache
* @param bool|false $pdfa
*/
public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $unicode = true, $encoding = 'UTF-8', $diskcache = false, $pdfa = false)
{
if (!class_exists('TCPDF', FALSE)) {
// Load SwiftMailer
require Kohana::find_file('vendor', 'tcpdf/tcpdf');
}
parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache, $pdfa);
// TODO:
}
开发者ID:snoblucha,项目名称:kohana-tcpdf,代码行数:20,代码来源:PDF.php
示例13: getPdfData
private function getPdfData()
{
$pdf = new \TCPDF();
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetFont('times', 'BI', 12);
$pdf->AddPage();
$pdf->Write(0, 'Fichier pdf', '', 0, 'C', true, 0, false, false, 0);
return $pdf->Output('fichier.pdf', 'S');
}
开发者ID:famfij,项目名称:TP-BilletsDuLouvre,代码行数:11,代码来源:TicketsSenderTest.php
示例14: Footer
public function Footer()
{
$txt = '';
if ($this->footer_param['form']) {
$txt = HTML2PDF::textGET('pdf05');
}
if ($this->footer_param['date'] && $this->footer_param['heure']) {
$txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf03');
}
if ($this->footer_param['date'] && !$this->footer_param['heure']) {
$txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf01');
}
if (!$this->footer_param['date'] && $this->footer_param['heure']) {
$txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf02');
}
if ($this->footer_param['page']) {
$txt .= ($txt ? ' - ' : '') . HTML2PDF::textGET('pdf04');
}
if (strlen($txt) > 0) {
$txt = str_replace('[[date_d]]', date('d'), $txt);
$txt = str_replace('[[date_m]]', date('m'), $txt);
$txt = str_replace('[[date_y]]', date('Y'), $txt);
$txt = str_replace('[[date_h]]', date('H'), $txt);
$txt = str_replace('[[date_i]]', date('i'), $txt);
$txt = str_replace('[[date_s]]', date('s'), $txt);
$txt = str_replace('[[current]]', $this->PageNo(), $txt);
$txt = str_replace('[[nb]]', '{nb}', $txt);
parent::SetY(-11);
$this->setOverline(false);
$this->SetFont('helvetica', 'I', 8);
$this->Cell(0, 10, $txt, 0, 0, 'R');
}
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:33,代码来源:mypdf.class.php
示例15: Rotate
private function Rotate($type, $x = -1, $y = -1)
{
if ($type == "") {
$angle = 0;
} elseif ($type == "Left") {
$angle = 90;
} elseif ($type == "Right") {
$angle = 270;
} elseif ($type == "UpsideDown") {
$angle = 180;
}
if ($x == -1) {
$x = $this->pdf->getX();
}
if ($y == -1) {
$y = $this->pdf->getY();
}
if ($this->angle != 0) {
$this->pdf->_out('Q');
}
$this->angle = $angle;
if ($angle != 0) {
$angle *= M_PI / 180;
$c = cos($angle);
$s = sin($angle);
$cx = $x * $this->pdf->k;
$cy = ($this->pdf->h - $y) * $this->pdf->k;
$this->pdf->_out(sprintf('q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm', $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}
开发者ID:fabiorossetto1,项目名称:phpjasperxml,代码行数:30,代码来源:SubReport.php
示例16: Footer
public function Footer()
{
$this->SetFont('helvetica', '', 10);
parent::Footer();
$this->Cell(0, 5, "", 0, 1, 'L', 0, '', 0, false, 'M', 'M');
$this->Cell(0, 8, "Report generated with Open-LIMS (" . date("dS M Y H:i") . ")", 0, 1, 'L', 0, '', 0, false, 'M', 'M');
}
开发者ID:suxinde2009,项目名称:www,代码行数:7,代码来源:sample_pdf.class.php
示例17: Footer
public function Footer()
{
if (defined('WPPTOPDFENH_CUSTOM_FOOTER')) {
$this->writeHTMLCell(WPPTOPDFENH_FOOTER_WIDTH, WPPTOPDFENH_FOOTER_MIN_HEIGHT, WPPTOPDFENH_FOOTER_X, WPPTOPDFENH_FOOTER_Y, WPPTOPDFENH_CUSTOM_FOOTER, WPPTOPDFENH_FOOTER_BORDER, 0, WPPTOPDFENH_FOOTER_FILL, true, WPPTOPDFENH_FOOTER_ALIGN, WPPTOPDFENH_FOOTER_PAD);
} else {
// call parent footer method for default footer
parent::Footer();
}
}
开发者ID:tinggao,项目名称:woofWarrior,代码行数:9,代码来源:wpptopdfenh_header.php
示例18:
/**
* Draws a filled rectangle at x1,y1 with width w and height h
*
* See {@link Style::munge_color()} for the format of the color array.
*
* @param float $x1
* @param float $y1
* @param float $w
* @param float $h
* @param array $color
*/
function filled_rectangle($x1, $y1, $w, $h, $color) {
$this->_set_fill_color($color);
// FIXME: ugh, need to handle styles here
$this->_pdf->rect($x1, $y1, $w, $h, "F");
}
开发者ID:hendrosteven,项目名称:f3-template,代码行数:18,代码来源:tcpdf_adapter.cls.php
示例19: _getLastAbsoluteY
/**
* get the last absolute Y
*
* @access protected
* @return float $y
*/
protected function _getLastAbsoluteY()
{
for ($k = count($this->table) - 1; $k >= 0; $k--) {
if ($this->table[$k]['y'] && $this->table[$k]['position']) return $this->table[$k]['y'];
}
return $this->_pdf->gettMargin();
}
开发者ID:jcodesdotme,项目名称:pp,代码行数:13,代码来源:parsingCss.class.php
示例20: array
function __construct($options)
{
$defaults = array('orientation' => 'P', 'unit' => 'mm', 'format' => 'A4', 'unicode' => true, 'encoding' => "UTF-8");
$options = is_array($options) ? am($defaults, $options) : $defaults;
extract(am($defaults, $options));
parent::__construct($orientation, $unit, $format, $unicode, $encoding);
}
开发者ID:predominant,项目名称:candycane,代码行数:7,代码来源:tcpdf.php
注:本文中的TCPDF类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论