本文整理汇总了PHP中tcpdf函数的典型用法代码示例。如果您正苦于以下问题:PHP tcpdf函数的具体用法?PHP tcpdf怎么用?PHP tcpdf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tcpdf函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_pdf
function create_pdf($content, $title)
{
tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$title = $title;
$obj_pdf->SetTitle('MultiTV analytics');
$obj_pdf->SetAuthor('MultiTv');
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
//ob_start();
// we can have any view part here like HTML, PHP etc
//$content = ob_get_contents();
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('output.pdf', 'I');
}
示例2: getAttatchment
public function getAttatchment()
{
$title = $this->input->get('title');
$attatch = $this->input->get('attatchment');
$this->form_validation->set_rules('reportTitle', 'Report Title', 'required');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
tcpdf();
// create new PDF document
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
//set title of report
$obj_pdf->SetAuthor($this->session->userdata['username']);
$obj_pdf->SetTitle($title);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
$obj_pdf->Image($attatch, 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
$path = 'C:/xampp/htdocs/QADash/public_html/reports';
// Supply a filename including the .pdf extension
$filename = $this->{$title};
// Create the full path
$full_path = $path . '/' . $filename;
// Output PDF
$obj_pdf->Output($full_path, 'F');
//save report details in database
$details = $this->saveReport($this->session->userdata['uid'], $filename, $path . '/' . $filename);
$this->report_m->saveReport($details);
//redirect to view the generated pdf file
$this->data['report'] = $filename;
$this->data['subview'] = 'manager/user/report/singleReport_view';
$this->load->view("manager/_layout_main", $this->data);
}
示例3: pdfConfig
/**
* @param $title User provided title for the report
* @return TCPDF object
*/
public function pdfConfig($title)
{
//call the libraries from helper class method
tcpdf();
// create new PDF document
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
//set title of report
$obj_pdf->SetAuthor($this->session->userdata['username']);
$obj_pdf->SetTitle($title);
$obj_pdf->SetCreator(PDF_CREATOR);
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
return $obj_pdf;
}
示例4: tcpdf
<?php
tcpdf();
$fontnama = TCPDF_FONTS::addTTFfont('certificatebold.ttf', 'TrueTypeUnicode', '', 96);
$font = TCPDF_FONTS::addTTFfont('Chocolate Covered Raindrops BOLD.ttf', 'TrueTypeUnicode', '', 100);
$obj_pdf = new TCPDF('P', PDF_UNIT, "LEGAL", true, 'UTF-8', true);
$obj_pdf->SetCreator("Hendy Andrianto S.Kom (www.facebook.com/opchaky.it)");
$toko = "LEMBAGA PENDIDIKAN KETERAMPILAN";
$hal = "GITA PERTIWI";
$alamat = "PUSAT : JL. KEBON TIWU I NO. 10 TASIKMALAYA";
$tlp = "(0265) 323445 HP. 085295168608";
$cabang = "CABANG : JL. RAYA TIMUR BOROLONG CILAMPUNG HILIR SINGAPARNA" . "\n" . "HP. 085353292292";
$judul = $alamat . "\n" . "TELP. " . $tlp;
$foto = "profile.jpg";
$cknama = $this->db->get_where('view_member', array('kode' => $kode))->result();
foreach ($cknama as $row) {
$nama = $row->nama;
$tgl = date('d-m-Y', strtotime($row->tgl_lahir));
$tempat = $row->tempat_lahir;
$jns = strtoupper($row->nama_tipe);
}
$ckhasil = $this->db->get_where('tbl_status_izajah', array('id' => $status))->result();
foreach ($ckhasil as $key) {
$hasil = $key->status;
}
$obj_pdf->SetTitle($toko);
$obj_pdf->SetHeaderData("", "", "", "");
$obj_pdf->SetPrintHeader(FALSE);
$obj_pdf->SetPrintFooter(FALSE);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', 9));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
示例5: get_pdf
public function get_pdf()
{
$this->load->helper('pdf_helper');
$this->load->library('users/auth');
//$html_content = $_POST['content'];
if (isset($_POST) && $this->auth->is_logged_in()) {
$html_content = '<style type="text/css">
table{text-align: center;}
table.appgeo-tab tr td{text-align:right;}
table.appgeo-tab-small tr {text-align: right;font-size: 0.84em;line-height: .85em;}
table.appgeo-tab-xxsmall tr {text-align: right;font-size: 0.75em;}
table.appgeo-tab-xxsmall tr td{padding: 1px;}
table.appgeo-tab-small tr td:first-child{text-align: left;}
table.appgeo-tab tr td:first-child{text-align: left;}
table tr.appgeo-tab-header th{ background-color: #B3A300; text-align: center;color: #FFF;font-weight: 300;font-size: 0.90em;}
tr.appgeo-tab-bold td{ font-weight: 600;}
tr.appgeo-tab-italic td{font-style: italic;}
td.source{ font-size: 0.7em;}
table.appgeo-tab tr.appg-tab-border-top{ border-top: 1px solid #000000;}
table.appgeo-tab-small tr.appg-tab-border-top{ border-top: 1px solid #000000;}
tr.appg-tab-evidence1{ background: #CCC;}
.zonage1 { background-color: #CAE746;}
.zonage2 {background-color: #9CE0D9;}
.title{height : 1.8;}
td { border:0.5px solid #666; padding:10px;line-height: 1.7;}
th { border:0.5px solid #666; padding:10px;line-height: 1.95;}
.entity-title{ font-size: 1.4em; line-height: 1.1em; font-weight: 300; color: #30B303; margin-bottom: 5px;}
.appgeo-source{ font-size: 0.65em; text-align: right; }
a.btn{display : none;}
</style>';
$html_content .= $_POST['content'];
$file_name = $_POST['filename'];
$file_path = 'temp/' . $file_name . '.pdf';
unlink($file_path);
tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF_8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
$title = 'Application DRHIL 2014';
$obj_pdf->SetTitle($title);
$obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
ob_start();
// we can have any view part here like HTML, PHP etc
$content = $html_content;
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
//$obj_pdf->SetDisplayMode('real','default');
$obj_pdf->Output($file_path, 'F');
$this->output->set_content_type('application/json')->set_output(json_encode($html_content));
return true;
}
return false;
Template::render('drhil02/ajax');
}
示例6: print_app
function print_app($app_id)
{
$this->load->helper("pdf_helper");
$obj_pdf = tcpdf();
$obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$obj_pdf->SetCreator(PDF_CREATOR);
// $title = "PDF Report";
// $obj_pdf->SetTitle($title);
// $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 9);
$obj_pdf->setFontSubsetting(false);
$obj_pdf->AddPage();
ob_start();
// we can have any view part here like HTML, PHP etc
$data = "";
$this->load->view("leasing/rpt/app_form", $data);
$content = ob_get_contents();
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('output.pdf', 'I');
}