本文整理匯總了PHP中Zend\Pdf\InternalType\AbstractTypeObject::phpToPDF方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractTypeObject::phpToPDF方法的具體用法?PHP AbstractTypeObject::phpToPDF怎麽用?PHP AbstractTypeObject::phpToPDF使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Pdf\InternalType\AbstractTypeObject
的用法示例。
在下文中一共展示了AbstractTypeObject::phpToPDF方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: render
/**
* Render the completed PDF to a string.
* If $newSegmentOnly is true, then only appended part of PDF is returned.
*
* @param boolean $newSegmentOnly
* @param resource $outputStream
* @return string
* @throws \Zend\Pdf\Exception
*/
public function render($newSegmentOnly = false, $outputStream = null)
{
// Save document properties if necessary
if ($this->properties != $this->_originalProperties) {
$docInfo = $this->_objFactory->newObject(new InternalType\DictionaryObject());
foreach ($this->properties as $key => $value) {
switch ($key) {
case 'Trapped':
switch ($value) {
case true:
$docInfo->{$key} = new InternalType\NameObject('True');
break;
case false:
$docInfo->{$key} = new InternalType\NameObject('False');
break;
case null:
$docInfo->{$key} = new InternalType\NameObject('Unknown');
break;
default:
throw new Exception\LogicException('Wrong Trapped document property vale: \'' . $value . '\'. Only true, false and null values are allowed.');
break;
}
case 'CreationDate':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'ModDate':
$docInfo->{$key} = new InternalType\StringObject((string) $value);
break;
case 'Title':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'Author':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'Subject':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'Keywords':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'Creator':
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
// break intentionally omitted
case 'Producer':
if (extension_loaded('mbstring') === true) {
$detected = mb_detect_encoding($value);
if ($detected !== 'ASCII') {
$value = chr(254) . chr(255) . mb_convert_encoding($value, 'UTF-16', $detected);
}
}
$docInfo->{$key} = new InternalType\StringObject((string) $value);
break;
default:
// Set property using PDF type based on PHP type
$docInfo->{$key} = InternalType\AbstractTypeObject::phpToPDF($value);
//.........這裏部分代碼省略.........