我喜欢在Invoice类构造方法中调用FPDF Construct类。如何将FPDF cass的构造方法调用到Invoice类?
发票类:
public function __construct($size='A4',$currency='$',$language='en') {
$this->columns = 4;
$this->items = array();
$this->totals = array();
$this->addText = array();
$this->firstColumnWidth = 70;
$this->currency = $currency;
$this->maxImageDimensions = array(230,130);
$this->setLanguage($language);
$this->setDocumentSize($size);
$this->setColor("#222222");
<!-- I want to call here fpdf construct class -->
$this->FPDF('P','mm',array($this->document['w'],$this->document['h']));
$this->AliasNbPages();
$this->SetMargins($this->margins['l'],$this->margins['t'],$this->margins['r']);
}
FPDF类:
function __construct($orientation='P', $unit='mm', $size='A4')
{
// Some checks
$this->_dochecks();
// Initialization of properties
$this->state = 0;
$this->page = 0;
$this->n = 2;
$this->buffer = '';
$this->SetCompression(true);
// Set default PDF version number
$this->PDFVersion = '1.3';
}
答案 0 :(得分:0)
简单地称之为:
parent::__construct('P','mm', array($this->document['w'],$this->document['h']));
有关详细信息,请参阅here。