/** * sets the paper format * * @param string $paperFormat represented by class constants PAPER_* * @throws PHPRtfLite_Exception */ public function setPaperFormat($paperFormat) { if (!isset($this->_paperFormats[$paperFormat])) { throw new PHPRtfLite_Exception("Paper format: '{$paperFormat}' is not supported!"); } list($width, $height) = $this->_paperFormats[$paperFormat]; $defaultUnit = PHPRtfLite_Unit::getGlobalUnit(); $this->_paperWidth = PHPRtfLite_Unit::convertTo($width, PHPRtfLite_Unit::UNIT_CM, $defaultUnit); $this->_paperHeight = PHPRtfLite_Unit::convertTo($height, PHPRtfLite_Unit::UNIT_CM, $defaultUnit); }
/** * Sets the paper format. * * @param string $paperFormat */ public function setPaperFormat($paperFormat) { $defaultUnit = PHPRtfLite_Unit::getGlobalUnit(); $paperWidth = PHPRtfLite_Paper_Format::getPaperWidthByPaperFormat($paperFormat); $this->_paperWidth = PHPRtfLite_Unit::convertTo($paperWidth, PHPRtfLite_Unit::UNIT_MM, $defaultUnit); $paperHeight = PHPRtfLite_Paper_Format::getPaperHeightByPaperFormat($paperFormat); $this->_paperHeight = PHPRtfLite_Unit::convertTo($paperHeight, PHPRtfLite_Unit::UNIT_MM, $defaultUnit); }