Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port tcpdf test to the Yii framework by GCI student Aaron Schmitz
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11699 b72ed6b6-b9f8-46b5-92b4-906544132732
- Loading branch information
Aaron Schmitz
committed
Dec 20, 2011
1 parent
0adaf27
commit 93c5302
Showing
2 changed files
with
20 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,5 +250,5 @@ | |
$tcpdf['cell_height_ratio'] = 1.25; | ||
$tcpdf['cell_padding'] = 0; | ||
|
||
|
||
return $tcpdf; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,38 @@ | ||
<?php if ( ! defined('BASEPATH')) die('No direct script access allowed'); | ||
|
||
class Tcpdf_check extends CI_Controller { | ||
class Tcpdf_check extends CAction { | ||
|
||
function __construct() | ||
{ | ||
parent::__construct(); | ||
public function run() | ||
{ | ||
$this->index(); | ||
} | ||
|
||
function index() | ||
{ | ||
$this->load->library('admin/pdf'); | ||
require ($this->config->item('homedir').'application/config/tcpdf_config_ci.php'); | ||
$this->_config = $tcpdf; | ||
$this->pdf->SetHeaderData( | ||
$this->_config['header_logo'], | ||
$this->_config['header_logo_width'], | ||
$this->_config['header_title'], | ||
$this->_config['header_string'] | ||
require_once(APPPATH.'/third_party/tcpdf/tcpdf.php'); | ||
Yii::app()->getConfig("tcpdf"); | ||
$pdf = new TCPDF(); | ||
$pdf->SetHeaderData( | ||
Yii::app()->getConfig('header_logo'), | ||
Yii::app()->getConfig('header_logo_width'), | ||
Yii::app()->getConfig('header_title'), | ||
Yii::app()->getConfig('header_string') | ||
); | ||
|
||
// set document information | ||
$this->pdf->SetSubject('TCPDF Tutorial'); | ||
$this->pdf->SetKeywords('TCPDF, PDF, example, test, guide'); | ||
$pdf->SetSubject('TCPDF Tutorial'); | ||
$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); | ||
|
||
// set font | ||
$this->pdf->SetFont('times', 'BI', 16); | ||
$pdf->SetFont('times', 'BI', 16); | ||
|
||
// add a page | ||
$this->pdf->AddPage(); | ||
$pdf->AddPage(); | ||
|
||
// print a line using Cell() | ||
$this->pdf->Cell(0, 12, 'Example 001 - Watsup dude', 1, 1, 'C'); | ||
$pdf->Cell(0, 12, 'Example 001 - Watsup dude', 1, 1, 'C'); | ||
|
||
//Close and output PDF document | ||
$this->pdf->Output('example_001.pdf', 'I'); | ||
$pdf->Output('example_001.pdf', 'I'); | ||
} | ||
} |