Skip to content

Commit

Permalink
MDL-15055 Upgrade shipped library TCPDF to version tcpdf_php5 TCPDF 4…
Browse files Browse the repository at this point in the history
….0.015

Modified lib/pdflib.php wrapper
  • Loading branch information
mudrd8mz committed Jul 29, 2008
1 parent 2f60a9c commit 884a3e4
Show file tree
Hide file tree
Showing 208 changed files with 52,543 additions and 6,364 deletions.
28 changes: 11 additions & 17 deletions lib/pdflib.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
*
* Example usage:
* $doc = new pdf;
* $doc->print_header = false;
* $doc->print_footer = false;
* $doc->setPrintHeader(false);
* $doc->setPrintFooter(false);
* $doc->AddPage();
* $doc->Write(5, 'Hello World!');
* $doc->Output();
Expand All @@ -53,13 +53,13 @@


/// Includes
require_once('tcpdf/tcpdf.php');
require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');



/// Constants
define('PDF_CUSTOM_FONT_PATH', $CFG->dataroot.'/fonts/');
define('PDF_DEFAULT_FONT', 'FreeSerif');
define('PDF_DEFAULT_FONT', 'DejaVuSerif');



Expand All @@ -70,11 +70,13 @@
class pdf extends TCPDF {

/**
* Constructor
* Class constructor
*
* See the parent class documentation for the parameters info.
*/
function pdf($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8') {
public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8') {

parent::TCPDF($orientation, $unit, $format, $unicode, $encoding);
parent::__construct($orientation, $unit, $format, $unicode, $encoding);

if (is_dir(PDF_CUSTOM_FONT_PATH)) {
$fontfiles = $this->_getfontfiles(PDF_CUSTOM_FONT_PATH);
Expand All @@ -92,19 +94,11 @@ function pdf($orientation='P', $unit='mm', $format='A4', $unicode=true, $encodin
}


/**
* Fake constructor to keep PHP5 happy.
*/
function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8') {
$this->pdf($orientation, $unit, $format, $unicode, $encoding);
}


/**
* Return fonts path
* Overriding TCPDF::_getfontpath()
*/
function _getfontpath() {
protected function _getfontpath() {
global $CFG;

if (is_dir(PDF_CUSTOM_FONT_PATH)
Expand All @@ -120,7 +114,7 @@ function _getfontpath() {
/**
* Get the .php files for the fonts
*/
function _getfontfiles($fontdir) {
protected function _getfontfiles($fontdir) {
$dirlist = get_directory_list($fontdir);
$fontfiles = array();

Expand Down
Loading

0 comments on commit 884a3e4

Please sign in to comment.