/** * Object constructor. * */ public function __construct() { parent::__construct(new InternalType\DictionaryObject()); $this->_resource->Type = new InternalType\NameObject('Font'); }
/** * Object constructor. */ public function __construct() { parent::__construct(''); $this->_resource->dictionary->Type = new InternalType\NameObject('XObject'); $this->_resource->dictionary->Subtype = new InternalType\NameObject('Image'); }
/** * Attach resource to the page * * @param string $type * @param \ZendPdf\Resource\AbstractResource $resource * @return string */ protected function _attachResource($type, Resource\AbstractResource $resource) { // Check that Resources dictionary contains appropriate resource set if ($this->_pageDictionary->Resources->{$type} === null) { $this->_pageDictionary->Resources->touch(); $this->_pageDictionary->Resources->{$type} = new InternalType\DictionaryObject(); } else { $this->_pageDictionary->Resources->{$type}->touch(); } // Check, that resource is already attached to resource set. $resObject = $resource->getResource(); foreach ($this->_pageDictionary->Resources->{$type}->getKeys() as $ResID) { if ($this->_pageDictionary->Resources->{$type}->{$ResID} === $resObject) { return $ResID; } } $idCounter = 1; do { $newResName = $type[0] . $idCounter++; } while ($this->_pageDictionary->Resources->{$type}->{$newResName} !== null); $this->_pageDictionary->Resources->{$type}->{$newResName} = $resObject; $this->_objFactory->attach($resource->getFactory()); return $newResName; }