import v1.1.0_RC2 | 2009-09-20

This commit is contained in:
2019-07-17 22:19:00 +02:00
parent 3b7ba80568
commit 38c146901c
2504 changed files with 101817 additions and 62316 deletions

398
libs/Zend/Pdf/Action.php Normal file
View File

@ -0,0 +1,398 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Action.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/** Zend_Pdf_Target */
require_once 'Zend/Pdf/Target.php';
/**
* Abstract PDF action representation class
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveIterator, Countable
{
/**
* Action dictionary
*
* @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
*/
protected $_actionDictionary;
/**
* An original list of chained actions
*
* @var array Array of Zend_Pdf_Action objects
*/
protected $_originalNextList;
/**
* A list of next actions in actions tree (used for actions chaining)
*
* @var array Array of Zend_Pdf_Action objects
*/
public $next = array();
/**
* Object constructor
*
* @param Zend_Pdf_Element_Dictionary $dictionary
* @param SplObjectStorage $processedActions list of already processed action dictionaries, used to avoid cyclic references
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
{
if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$dictionary mast be a direct or an indirect dictionary object.');
}
$this->_actionDictionary = $dictionary;
if ($dictionary->Next !== null) {
if ($dictionary->Next instanceof Zend_Pdf_Element_Dictionary) {
// Check if dictionary object is not already processed
if (!$processedActions->contains($dictionary->Next)) {
$processedActions->attach($dictionary->Next);
$this->next[] = Zend_Pdf_Action::load($dictionary->Next, $processedActions);
}
} else if ($dictionary->Next instanceof Zend_Pdf_Element_Array) {
foreach ($dictionary->Next->items as $chainedActionDictionary) {
// Check if dictionary object is not already processed
if (!$processedActions->contains($chainedActionDictionary)) {
$processedActions->attach($chainedActionDictionary);
$this->next[] = Zend_Pdf_Action::load($chainedActionDictionary, $processedActions);
}
}
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('PDF Action dictionary Next entry must be a dictionary or an array.');
}
}
$this->_originalNextList = $this->next;
}
/**
* Load PDF action object using specified dictionary
*
* @internal
* @param Zend_Pdf_Element $dictionary (It's actually Dictionary or Dictionary Object or Reference to a Dictionary Object)
* @param SplObjectStorage $processedActions list of already processed action dictionaries, used to avoid cyclic references
* @return Zend_Pdf_Action
* @throws Zend_Pdf_Exception
*/
public static function load(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions = null)
{
if ($processedActions === null) {
$processedActions = new SplObjectStorage();
}
if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$dictionary mast be a direct or an indirect dictionary object.');
}
if (isset($dictionary->Type) && $dictionary->Type->value != 'Action') {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Action dictionary Type entry must be set to \'Action\'.');
}
if ($dictionary->S === null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Action dictionary must contain S entry');
}
switch ($dictionary->S->value) {
case 'GoTo':
require_once 'Zend/Pdf/Action/GoTo.php';
return new Zend_Pdf_Action_GoTo($dictionary, $processedActions);
brake;
case 'GoToR':
require_once 'Zend/Pdf/Action/GoToR.php';
return new Zend_Pdf_Action_GoToR($dictionary, $processedActions);
brake;
case 'GoToE':
require_once 'Zend/Pdf/Action/GoToE.php';
return new Zend_Pdf_Action_GoToE($dictionary, $processedActions);
brake;
case 'Launch':
require_once 'Zend/Pdf/Action/Launch.php';
return new Zend_Pdf_Action_Launch($dictionary, $processedActions);
brake;
case 'Thread':
require_once 'Zend/Pdf/Action/Thread.php';
return new Zend_Pdf_Action_Thread($dictionary, $processedActions);
brake;
case 'URI':
require_once 'Zend/Pdf/Action/URI.php';
return new Zend_Pdf_Action_URI($dictionary, $processedActions);
brake;
case 'Sound':
require_once 'Zend/Pdf/Action/Sound.php';
return new Zend_Pdf_Action_Sound($dictionary, $processedActions);
brake;
case 'Movie':
require_once 'Zend/Pdf/Action/Movie.php';
return new Zend_Pdf_Action_Movie($dictionary, $processedActions);
brake;
case 'Hide':
require_once 'Zend/Pdf/Action/Hide.php';
return new Zend_Pdf_Action_Hide($dictionary, $processedActions);
brake;
case 'Named':
require_once 'Zend/Pdf/Action/Named.php';
return new Zend_Pdf_Action_Named($dictionary, $processedActions);
brake;
case 'SubmitForm':
require_once 'Zend/Pdf/Action/SubmitForm.php';
return new Zend_Pdf_Action_SubmitForm($dictionary, $processedActions);
brake;
case 'ResetForm':
require_once 'Zend/Pdf/Action/ResetForm.php';
return new Zend_Pdf_Action_ResetForm($dictionary, $processedActions);
brake;
case 'ImportData':
require_once 'Zend/Pdf/Action/ImportData.php';
return new Zend_Pdf_Action_ImportData($dictionary, $processedActions);
brake;
case 'JavaScript':
require_once 'Zend/Pdf/Action/JavaScript.php';
return new Zend_Pdf_Action_JavaScript($dictionary, $processedActions);
brake;
case 'SetOCGState':
require_once 'Zend/Pdf/Action/SetOCGState.php';
return new Zend_Pdf_Action_SetOCGState($dictionary, $processedActions);
brake;
case 'Rendition':
require_once 'Zend/Pdf/Action/Rendition.php';
return new Zend_Pdf_Action_Rendition($dictionary, $processedActions);
brake;
case 'Trans':
require_once 'Zend/Pdf/Action/Trans.php';
return new Zend_Pdf_Action_Trans($dictionary, $processedActions);
brake;
case 'GoTo3DView':
require_once 'Zend/Pdf/Action/GoTo3DView.php';
return new Zend_Pdf_Action_GoTo3DView($dictionary, $processedActions);
brake;
default:
require_once 'Zend/Pdf/Action/Unknown.php';
return new Zend_Pdf_Action_Unknown($dictionary, $processedActions);
brake;
}
}
/**
* Get resource
*
* @internal
* @return Zend_Pdf_Element
*/
public function getResource()
{
return $this->_actionDictionary;
}
/**
* Dump Action and its child actions into PDF structures
*
* Returns dictionary indirect object or reference
*
* @internal
* @param Zend_Pdf_ElementFactory $factory Object factory for newly created indirect objects
* @param SplObjectStorage $processedActions list of already processed actions (used to prevent infinity loop caused by cyclic references)
* @return Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference Dictionary indirect object
*/
public function dumpAction(Zend_Pdf_ElementFactory_Interface $factory, SplObjectStorage $processedActions = null)
{
if ($processedActions === null) {
$processedActions = new SplObjectStorage();
}
if ($processedActions->contains($this)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Action chain cyclyc reference is detected.');
}
$processedActions->attach($this);
$childListUpdated = false;
if (count($this->_originalNextList) != count($this->next)) {
// If original and current children arrays have different size then children list was updated
$childListUpdated = true;
} else if ( !(array_keys($this->_originalNextList) === array_keys($this->next)) ) {
// If original and current children arrays have different keys (with a glance to an order) then children list was updated
$childListUpdated = true;
} else {
foreach ($this->next as $key => $childAction) {
if ($this->_originalNextList[$key] !== $childAction) {
$childListUpdated = true;
break;
}
}
}
if ($childListUpdated) {
$this->_actionDictionary->touch();
switch (count($this->next)) {
case 0:
$this->_actionDictionary->Next = null;
break;
case 1:
$child = reset($this->next);
$this->_actionDictionary->Next = $child->dumpAction($factory, $processedActions);
break;
default:
$pdfChildArray = new Zend_Pdf_Element_Array();
foreach ($this->next as $child) {
$pdfChildArray->items[] = $child->dumpAction($factory, $processedActions);
}
$this->_actionDictionary->Next = $pdfChildArray;
break;
}
} else {
foreach ($this->next as $child) {
$child->dumpAction($factory, $processedActions);
}
}
if ($this->_actionDictionary instanceof Zend_Pdf_Element_Dictionary) {
// It's a newly created action. Register it within object factory and return indirect object
return $factory->newObject($this->_actionDictionary);
} else {
// It's a loaded object
return $this->_actionDictionary;
}
}
////////////////////////////////////////////////////////////////////////
// RecursiveIterator interface methods
//////////////
/**
* Returns current child action.
*
* @return Zend_Pdf_Action
*/
public function current()
{
return current($this->next);
}
/**
* Returns current iterator key
*
* @return integer
*/
public function key()
{
return key($this->next);
}
/**
* Go to next child
*/
public function next()
{
return next($this->next);
}
/**
* Rewind children
*/
public function rewind()
{
return reset($this->next);
}
/**
* Check if current position is valid
*
* @return boolean
*/
public function valid()
{
return current($this->next) !== false;
}
/**
* Returns the child action.
*
* @return Zend_Pdf_Outline|null
*/
public function getChildren()
{
return current($this->next);
}
/**
* Implements RecursiveIterator interface.
*
* @return bool whether container has any pages
*/
public function hasChildren()
{
return count($this->next) > 0;
}
////////////////////////////////////////////////////////////////////////
// Countable interface methods
//////////////
/**
* count()
*
* @return int
*/
public function count()
{
return count($this->childOutlines);
}
}

View File

@ -0,0 +1,114 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: GoTo.php 17245 2009-07-28 13:59:45Z alexander $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/**
* PDF 'Go to' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_GoTo extends Zend_Pdf_Action
{
/**
* GoTo Action destination
*
* @var Zend_Pdf_Destination
*/
protected $_destination;
/**
* Object constructor
*
* @param Zend_Pdf_Element_Dictionary $dictionary
* @param SplObjectStorage $processedActions list of already processed action dictionaries, used to avoid cyclic references
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedActions)
{
parent::__construct($dictionary, $processedActions);
$this->_destination = Zend_Pdf_Destination::load($dictionary->D);
}
/**
* Create new Zend_Pdf_Action_GoTo object using specified destination
*
* @param Zend_Pdf_Destination|string $destination
* @return Zend_Pdf_Action_GoTo
*/
public static function create($destination)
{
if (is_string($destination)) {
require_once 'Zend/Pdf/Destination/Named.php';
$destination = Zend_Pdf_Destination_Named::create($destination);
}
if (!$destination instanceof Zend_Pdf_Destination) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$destination parameter must be a Zend_Pdf_Destination object or string.');
}
$dictionary = new Zend_Pdf_Element_Dictionary();
$dictionary->Type = new Zend_Pdf_Element_Name('Action');
$dictionary->S = new Zend_Pdf_Element_Name('GoTo');
$dictionary->Next = null;
$dictionary->D = $destination->getResource();
return new Zend_Pdf_Action_GoTo($dictionary, new SplObjectStorage());
}
/**
* Set goto action destination
*
* @return Zend_Pdf_Action_GoTo
*/
public function setDestination(Zend_Pdf_Destination $destination)
{
$this->_destination = $destination;
$this->_actionDictionary->touch();
$this->_actionDictionary->D = $destination->getResource();
return $this;
}
/**
* Get goto action destination
*
* @return Zend_Pdf_Destination
*/
public function getDestination()
{
return $this->_destination;
}
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: GoTo3DView.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Set the current view of a 3D annotation' action
* PDF 1.6+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_GoTo3DView extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: GoToE.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Go to a destination in an embedded file' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_GoToE extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: GoToR.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Go to a destination in another document' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_GoToR extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Hide.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Set an annotations Hidden flag' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Hide extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ImportData.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Import field values from a file' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_ImportData extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: JavaScript.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Execute a JavaScript script' action
* PDF 1.3+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_JavaScript extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Launch.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Launch an application, usually to open a file' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Launch extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Movie.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Play a movie' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Movie extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Named.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Execute an action predefined by the viewer application' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Named extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Rendition.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Controls the playing of multimedia content' action
* PDF 1.5+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Rendition extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ResetForm.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Set fields to their default values' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_ResetForm extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SetOCGState.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Set the states of optional content groups' action
* PDF 1.5+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_SetOCGState extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Sound.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Play a sound' action representation class
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Sound extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SubmitForm.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Send data to a uniform resource locator' action
* PDF 1.2+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_SubmitForm extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Thread.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Begin reading an article thread' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Thread extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,39 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Trans.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Updates the display of a document, using a transition dictionary' action
* PDF 1.5+ feature
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Trans extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: URI.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF 'Resolve a uniform resource identifier' action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_URI extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,38 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Unknown.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* Unrecognized PDF action
*
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Action_Unknown extends Zend_Pdf_Action
{
}

View File

@ -0,0 +1,230 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id:
*/
/** @see Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* Abstract PDF annotation representation class
*
* An annotation associates an object such as a note, sound, or movie with a location
* on a page of a PDF document, or provides a way to interact with the user by
* means of the mouse and keyboard.
*
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Annotation
{
/**
* Annotation dictionary
*
* @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
*/
protected $_annotationDictionary;
/**
* Get annotation dictionary
*
* @internal
* @return Zend_Pdf_Element
*/
public function getResource()
{
return $this->_annotationDictionary;
}
/**
* Set bottom edge of the annotation rectangle.
*
* @param float $bottom
* @return Zend_Pdf_Annotation
*/
public function setBottom($bottom) {
$this->_annotationDictionary->Rect->items[1]->touch();
$this->_annotationDictionary->Rect->items[1]->value = $bottom;
return $this;
}
/**
* Get bottom edge of the annotation rectangle.
*
* @return float
*/
public function getBottom() {
return $this->_annotationDictionary->Rect->items[1]->value;
}
/**
* Set top edge of the annotation rectangle.
*
* @param float $top
* @return Zend_Pdf_Annotation
*/
public function setTop($top) {
$this->_annotationDictionary->Rect->items[3]->touch();
$this->_annotationDictionary->Rect->items[3]->value = $top;
return $this;
}
/**
* Get top edge of the annotation rectangle.
*
* @return float
*/
public function getTop() {
return $this->_annotationDictionary->Rect->items[3]->value;
}
/**
* Set right edge of the annotation rectangle.
*
* @param float $right
* @return Zend_Pdf_Annotation
*/
public function setRight($right) {
$this->_annotationDictionary->Rect->items[2]->touch();
$this->_annotationDictionary->Rect->items[2]->value = $right;
return $this;
}
/**
* Get right edge of the annotation rectangle.
*
* @return float
*/
public function getRight() {
return $this->_annotationDictionary->Rect->items[2]->value;
}
/**
* Set left edge of the annotation rectangle.
*
* @param float $left
* @return Zend_Pdf_Annotation
*/
public function setLeft($left) {
$this->_annotationDictionary->Rect->items[0]->touch();
$this->_annotationDictionary->Rect->items[0]->value = $left;
return $this;
}
/**
* Get left edge of the annotation rectangle.
*
* @return float
*/
public function getLeft() {
return $this->_annotationDictionary->Rect->items[0]->value;
}
/**
* Return text to be displayed for the annotation or, if this type of annotation
* does not display text, an alternate description of the annotations contents
* in human-readable form.
*
* @return string
*/
public function getText() {
if ($this->_annotationDictionary->Contents === null) {
return '';
}
return $this->_annotationDictionary->Contents->value;
}
/**
* Set text to be displayed for the annotation or, if this type of annotation
* does not display text, an alternate description of the annotations contents
* in human-readable form.
*
* @param string $text
* @return Zend_Pdf_Annotation
*/
public function setText($text) {
if ($this->_annotationDictionary->Contents === null) {
$this->_annotationDictionary->touch();
$this->_annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
} else {
$this->_annotationDictionary->Contents->touch();
$this->_annotationDictionary->Contents->value = new Zend_Pdf_Element_String($text);
}
return $this;
}
/**
* Annotation object constructor
*
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $annotationDictionary)
{
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
}
$this->_annotationDictionary = $annotationDictionary;
if ($this->_annotationDictionary->Type !== null &&
$this->_annotationDictionary->Type->value != 'Annot') {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong resource type. \'Annot\' expected.');
}
if ($this->_annotationDictionary->Rect === null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('\'Rect\' dictionary entry is required.');
}
if (count($this->_annotationDictionary->Rect->items) != 4 ||
$this->_annotationDictionary->Rect->items[0]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
$this->_annotationDictionary->Rect->items[1]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
$this->_annotationDictionary->Rect->items[2]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ||
$this->_annotationDictionary->Rect->items[3]->getType() != Zend_Pdf_Element::TYPE_NUMERIC ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('\'Rect\' dictionary entry must be an array of four numeric elements.');
}
}
/**
* Load Annotation object from a specified resource
*
* @internal
* @param $destinationArray
* @return Zend_Pdf_Destination
*/
public static function load(Zend_Pdf_Element $resource)
{
/** @todo implementation */
}
}

View File

@ -0,0 +1,93 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id:
*/
/** Zend_Pdf_Annotation */
require_once 'Zend/Pdf/Annotation.php';
/**
* A file attachment annotation contains a reference to a file,
* which typically is embedded in the PDF file.
*
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Annotation_FileAttachment extends Zend_Pdf_Annotation
{
/**
* Annotation object constructor
*
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $annotationDictionary)
{
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
}
if ($annotationDictionary->Subtype === null ||
$annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
$annotationDictionary->Subtype->value != 'FileAttachment') {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Subtype => FileAttachment entry is requires');
}
parent::__construct($annotationDictionary);
}
/**
* Create link annotation object
*
* @param float $x1
* @param float $y1
* @param float $x2
* @param float $y2
* @param string $fileSpecification
* @return Zend_Pdf_Annotation_FileAttachment
*/
public static function create($x1, $y1, $x2, $y2, $fileSpecification)
{
$annotationDictionary = new Zend_Pdf_Element_Dictionary();
$annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
$annotationDictionary->Subtype = new Zend_Pdf_Element_Name('FileAttachment');
$rectangle = new Zend_Pdf_Element_Array();
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
$annotationDictionary->Rect = $rectangle;
$fsDictionary = new Zend_Pdf_Element_Dictionary();
$fsDictionary->Type = new Zend_Pdf_Element_Name('Filespec');
$fsDictionary->F = new Zend_Pdf_Element_String($fileSpecification);
$annotationDictionary->FS = $fsDictionary;
return new Zend_Pdf_Annotation_FileAttachment($annotationDictionary);
}
}

View File

@ -0,0 +1,156 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id:
*/
/** Zend_Pdf_Annotation */
require_once 'Zend/Pdf/Annotation.php';
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/**
* A link annotation represents either a hypertext link to a destination elsewhere in
* the document or an action to be performed.
*
* Only destinations are used now since only GoTo action can be created by user
* in current implementation.
*
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Annotation_Link extends Zend_Pdf_Annotation
{
/**
* Annotation object constructor
*
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $annotationDictionary)
{
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
}
if ($annotationDictionary->Subtype === null ||
$annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
$annotationDictionary->Subtype->value != 'Link') {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Subtype => Link entry is requires');
}
parent::__construct($annotationDictionary);
}
/**
* Create link annotation object
*
* @param float $x1
* @param float $y1
* @param float $x2
* @param float $y2
* @param Zend_Pdf_Target|string $target
* @return Zend_Pdf_Annotation_Link
*/
public static function create($x1, $y1, $x2, $y2, $target)
{
if (is_string($target)) {
require_once 'Zend/Pdf/Destination/Named.php';
$destination = Zend_Pdf_Destination_Named::create($target);
}
if (!$target instanceof Zend_Pdf_Target) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$target parameter must be a Zend_Pdf_Target object or a string.');
}
$annotationDictionary = new Zend_Pdf_Element_Dictionary();
$annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
$annotationDictionary->Subtype = new Zend_Pdf_Element_Name('Link');
$rectangle = new Zend_Pdf_Element_Array();
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
$annotationDictionary->Rect = $rectangle;
if ($target instanceof Zend_Pdf_Destination) {
$annotationDictionary->Dest = $target->getResource();
} else {
$annotationDictionary->A = $target->getResource();
}
return new Zend_Pdf_Annotation_Link($annotationDictionary);
}
/**
* Set link annotation destination
*
* @param Zend_Pdf_Target|string $target
* @return Zend_Pdf_Annotation_Link
*/
public function setDestination($target)
{
if (is_string($target)) {
require_once 'Zend/Pdf/Destination/Named.php';
$destination = Zend_Pdf_Destination_Named::create($target);
}
if (!$target instanceof Zend_Pdf_Target) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$target parameter must be a Zend_Pdf_Target object or a string.');
}
$this->_annotationDictionary->touch();
$this->_annotationDictionary->Dest = $destination->getResource();
if ($target instanceof Zend_Pdf_Destination) {
$this->_annotationDictionary->Dest = $target->getResource();
$this->_annotationDictionary->A = null;
} else {
$this->_annotationDictionary->Dest = null;
$this->_annotationDictionary->A = $target->getResource();
}
return $this;
}
/**
* Get link annotation destination
*
* @return Zend_Pdf_Target|null
*/
public function getDestination()
{
if ($this->_annotationDictionary->Dest === null &&
$this->_annotationDictionary->A === null) {
return null;
}
if ($this->_annotationDictionary->Dest !== null) {
return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
} else {
return Zend_Pdf_Action::load($this->_annotationDictionary->A);
}
}
}

View File

@ -0,0 +1,87 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id:
*/
/** Zend_Pdf_Annotation */
require_once 'Zend/Pdf/Annotation.php';
/**
* A text annotation represents a "sticky note" attached to a point in the PDF document.
*
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Annotation_Text extends Zend_Pdf_Annotation
{
/**
* Annotation object constructor
*
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $annotationDictionary)
{
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
}
if ($annotationDictionary->Subtype === null ||
$annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
$annotationDictionary->Subtype->value != 'Text') {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Subtype => Text entry is requires');
}
parent::__construct($annotationDictionary);
}
/**
* Create link annotation object
*
* @param float $x1
* @param float $y1
* @param float $x2
* @param float $y2
* @param string $text
* @return Zend_Pdf_Annotation_Text
*/
public static function create($x1, $y1, $x2, $y2, $text)
{
$annotationDictionary = new Zend_Pdf_Element_Dictionary();
$annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
$annotationDictionary->Subtype = new Zend_Pdf_Element_Name('Text');
$rectangle = new Zend_Pdf_Element_Array();
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
$annotationDictionary->Rect = $rectangle;
$annotationDictionary->Contents = new Zend_Pdf_Element_String($text);
return new Zend_Pdf_Annotation_Text($annotationDictionary);
}
}

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Cmap.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Cmap_ByteEncoding */
@ -56,7 +58,7 @@ require_once 'Zend/Pdf/Cmap/TrimmedTable.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Cmap

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ByteEncoding.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Cmap */
@ -34,7 +36,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Static.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Cmap_ByteEncoding */
@ -30,7 +32,7 @@ require_once 'Zend/Pdf/Cmap/ByteEncoding.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Cmap_ByteEncoding_Static extends Zend_Pdf_Cmap_ByteEncoding

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: SegmentToDelta.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Cmap */
@ -31,7 +33,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TrimmedTable.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Cmap */
@ -31,7 +33,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Color.php 16978 2009-07-22 19:59:40Z alexander $
*/
@ -26,7 +28,7 @@
* others don't do it. That is defined in a subclasses.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Color
@ -40,5 +42,12 @@ abstract class Zend_Pdf_Color
* @return string
*/
abstract public function instructions($stroking);
/**
* Get color components (color space dependent)
*
* @return array
*/
abstract public function getComponents();
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Cmyk.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Color */
@ -29,7 +30,7 @@ require_once 'Zend/Pdf/Element/Numeric.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Color_Cmyk extends Zend_Pdf_Color
@ -77,22 +78,22 @@ class Zend_Pdf_Color_Cmyk extends Zend_Pdf_Color
*/
public function __construct($c, $m, $y, $k)
{
if ($c < 0) { $c = 0; }
if ($c > 1) { $c = 1; }
if ($m < 0) { $m = 0; }
if ($m > 1) { $m = 1; }
if ($y < 0) { $y = 0; }
if ($y > 1) { $y = 1; }
if ($k < 0) { $k = 0; }
if ($k > 1) { $k = 1; }
$this->_c = new Zend_Pdf_Element_Numeric($c);
$this->_m = new Zend_Pdf_Element_Numeric($m);
$this->_y = new Zend_Pdf_Element_Numeric($y);
$this->_k = new Zend_Pdf_Element_Numeric($k);
if ($this->_c->value < 0) { $this->_c->value = 0; }
if ($this->_c->value > 1) { $this->_c->value = 1; }
if ($this->_m->value < 0) { $this->_m->value = 0; }
if ($this->_m->value > 1) { $this->_m->value = 1; }
if ($this->_y->value < 0) { $this->_y->value = 0; }
if ($this->_y->value > 1) { $this->_y->value = 1; }
if ($this->_k->value < 0) { $this->_k->value = 0; }
if ($this->_k->value > 1) { $this->_k->value = 1; }
}
/**
@ -110,5 +111,15 @@ class Zend_Pdf_Color_Cmyk extends Zend_Pdf_Color
. $this->_y->toString() . ' '
. $this->_k->toString() . ($stroking? " K\n" : " k\n");
}
/**
* Get color components (color space dependent)
*
* @return array
*/
public function getComponents()
{
return array($this->_c->value, $this->_m->value, $this->_y->value, $this->_k->value);
}
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: GrayScale.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Color */
@ -29,7 +30,7 @@ require_once 'Zend/Pdf/Element/Numeric.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Color_GrayScale extends Zend_Pdf_Color
@ -49,15 +50,10 @@ class Zend_Pdf_Color_GrayScale extends Zend_Pdf_Color
*/
public function __construct($grayLevel)
{
if ($grayLevel < 0) { $grayLevel = 0; }
if ($grayLevel > 1) { $grayLevel = 1; }
$this->_grayLevel = new Zend_Pdf_Element_Numeric($grayLevel);
if ($this->_grayLevel->value < 0) {
$this->_grayLevel->value = 0;
}
if ($this->_grayLevel->value > 1) {
$this->_grayLevel->value = 1;
}
}
/**
@ -72,5 +68,15 @@ class Zend_Pdf_Color_GrayScale extends Zend_Pdf_Color
{
return $this->_grayLevel->toString() . ($stroking? " G\n" : " g\n");
}
/**
* Get color components (color space dependent)
*
* @return array
*/
public function getComponents()
{
return array($this->_grayLevel->value);
}
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Html.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Color */
@ -35,7 +36,7 @@ require_once 'Zend/Pdf/Color/GrayScale.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Color_Html extends Zend_Pdf_Color
@ -73,6 +74,16 @@ class Zend_Pdf_Color_Html extends Zend_Pdf_Color
return $this->_color->instructions($stroking);
}
/**
* Get color components (color space dependent)
*
* @return array
*/
public function getComponents()
{
return $this->_color->getComponents();
}
/**
* Creates a Zend_Pdf_Color object from the HTML representation.
*

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Rgb.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Color */
@ -29,7 +30,7 @@ require_once 'Zend/Pdf/Element/Numeric.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Color_Rgb extends Zend_Pdf_Color
@ -97,5 +98,15 @@ class Zend_Pdf_Color_Rgb extends Zend_Pdf_Color
. $this->_g->toString() . ' '
. $this->_b->toString() . ($stroking? " RG\n" : " rg\n");
}
/**
* Get color components (color space dependent)
*
* @return array
*/
public function getComponents()
{
return array($this->_r->value, $this->_g->value, $this->_b->value);
}
}

View File

@ -0,0 +1,113 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Destination.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/** Zend_Pdf_Page */
require_once 'Zend/Pdf/Page.php';
/** Zend_Pdf_Target */
require_once 'Zend/Pdf/Target.php';
/**
* Abstract PDF destination representation class
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Destination extends Zend_Pdf_Target
{
/**
* Load Destination object from a specified resource
*
* @internal
* @param $destinationArray
* @return Zend_Pdf_Destination
*/
public static function load(Zend_Pdf_Element $resource)
{
if ($resource->getType() == Zend_Pdf_Element::TYPE_NAME || $resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
require_once 'Zend/Pdf/Destination/Named.php';
return new Zend_Pdf_Destination_Named($resource);
}
if ($resource->getType() != Zend_Pdf_Element::TYPE_ARRAY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('An explicit destination must be a direct or an indirect array object.');
}
if (count($resource->items) < 2) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('An explicit destination array must contain at least two elements.');
}
switch ($resource->items[1]->value) {
case 'XYZ':
require_once 'Zend/Pdf/Destination/Zoom.php';
return new Zend_Pdf_Destination_Zoom($resource);
break;
case 'Fit':
require_once 'Zend/Pdf/Destination/Fit.php';
return new Zend_Pdf_Destination_Fit($resource);
break;
case 'FitH':
require_once 'Zend/Pdf/Destination/FitHorizontally.php';
return new Zend_Pdf_Destination_FitHorizontally($resource);
break;
case 'FitV':
require_once 'Zend/Pdf/Destination/FitVertically.php';
return new Zend_Pdf_Destination_FitVertically($resource);
break;
case 'FitR':
require_once 'Zend/Pdf/Destination/FitRectangle.php';
return new Zend_Pdf_Destination_FitRectangle($resource);
break;
case 'FitB':
require_once 'Zend/Pdf/Destination/FitBoundingBox.php';
return new Zend_Pdf_Destination_FitBoundingBox($resource);
break;
case 'FitBH':
require_once 'Zend/Pdf/Destination/FitBoundingBoxHorizontally.php';
return new Zend_Pdf_Destination_FitBoundingBoxHorizontally($resource);
break;
case 'FitBV':
require_once 'Zend/Pdf/Destination/FitBoundingBoxVertically.php';
return new Zend_Pdf_Destination_FitBoundingBoxVertically($resource);
break;
default:
require_once 'Zend/Pdf/Destination/Unknown.php';
return new Zend_Pdf_Destination_Unknown($resource);
break;
}
}
}

View File

@ -0,0 +1,121 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Destination.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Page */
require_once 'Zend/Pdf/Page.php';
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/**
* Abstract PDF explicit destination representation class
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Destination_Explicit extends Zend_Pdf_Destination
{
/**
* Destination description array
*
* @var Zend_Pdf_Element_Array
*/
protected $_destinationArray;
/**
* True if it's a remote destination
*
* @var boolean
*/
protected $_isRemote;
/**
* Explicit destination object constructor
*
* @param Zend_Pdf_Element $destinationArray
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $destinationArray)
{
if ($destinationArray->getType() != Zend_Pdf_Element::TYPE_ARRAY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Explicit destination resource Array must be a direct or an indirect array object.');
}
$this->_destinationArray = $destinationArray;
switch (count($this->_destinationArray->items)) {
case 0:
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Destination array must contain a page reference.');
break;
case 1:
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Destination array must contain a destination type name.');
break;
default:
// Do nothing
break;
}
switch ($this->_destinationArray->items[0]->getType()) {
case Zend_Pdf_Element::TYPE_NUMERIC:
$this->_isRemote = true;
break;
case Zend_Pdf_Element::TYPE_DICTIONARY:
$this->_isRemote = false;
break;
default:
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Destination target must be a page number or page dictionary object.');
break;
}
}
/**
* Returns true if it's a remote destination
*
* @return boolean
*/
public function isRemote()
{
return $this->_isRemote;
}
/**
* Get resource
*
* @internal
* @return Zend_Pdf_Element
*/
public function getResource()
{
return $this->_destinationArray;
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Fit.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_Fit explicit detination
*
* Destination array: [page /Fit]
*
* Display the page designated by page, with its contents magnified just enough
* to fit the entire page within the window both horizontally and vertically. If
* the required horizontal and vertical magnification factors are different, use
* the smaller of the two, centering the page within the window in the other
* dimension.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_Fit extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @return Zend_Pdf_Destination_Fit
* @throws Zend_Pdf_Exception
*/
public static function create($page)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('Fit');
return new Zend_Pdf_Destination_Fit($destinationArray);
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitBoundingBox.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitBoundingBox explicit detination
*
* Destination array: [page /FitB]
*
* (PDF 1.1) Display the page designated by page, with its contents magnified
* just enough to fit its bounding box entirely within the window both horizontally
* and vertically. If the required horizontal and vertical magnification
* factors are different, use the smaller of the two, centering the bounding box
* within the window in the other dimension.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitBoundingBox extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @return Zend_Pdf_Destination_FitBoundingBox
* @throws Zend_Pdf_Exception
*/
public static function create($page)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitB');
return new Zend_Pdf_Destination_FitBoundingBox($destinationArray);
}
}

View File

@ -0,0 +1,92 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitBoundingBoxHorizontally.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitBoundingBoxHorizontally explicit detination
*
* Destination array: [page /FitBH top]
*
* (PDF 1.1) Display the page designated by page, with the vertical coordinate
* top positioned at the top edge of the window and the contents of the page
* magnified just enough to fit the entire width of its bounding box within the
* window.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitBoundingBoxHorizontally extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $top Top edge of displayed page
* @return Zend_Pdf_Destination_FitBoundingBoxHorizontally
* @throws Zend_Pdf_Exception
*/
public static function create($page, $top)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitBH');
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
return new Zend_Pdf_Destination_FitBoundingBoxHorizontally($destinationArray);
}
/**
* Get top edge of the displayed page
*
* @return float
*/
public function getTopEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set top edge of the displayed page
*
* @param float $top
* @return Zend_Pdf_Action_FitBoundingBoxHorizontally
*/
public function setTopEdge($top)
{
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($top);
return $this;
}
}

View File

@ -0,0 +1,93 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitBoundingBoxVertically.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitBoundingBoxVertically explicit detination
*
* Destination array: [page /FitBV left]
*
* (PDF 1.1) Display the page designated by page, with the horizontal coordinate
* left positioned at the left edge of the window and the contents of the page
* magnified just enough to fit the entire height of its bounding box within the
* window.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitBoundingBoxVertically extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @return Zend_Pdf_Destination_FitBoundingBoxVertically
* @throws Zend_Pdf_Exception
*/
public static function create($page, $left)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitBV');
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
return new Zend_Pdf_Destination_FitBoundingBoxVertically($destinationArray);
}
/**
* Get left edge of the displayed page
*
* @return float
*/
public function getLeftEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set left edge of the displayed page
*
* @param float $left
* @return Zend_Pdf_Action_FitBoundingBoxVertically
*/
public function setLeftEdge($left)
{
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
return $this;
}
}

View File

@ -0,0 +1,92 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitHorizontally.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitHorizontally explicit detination
*
* Destination array: [page /FitH top]
*
* Display the page designated by page, with the vertical coordinate top positioned
* at the top edge of the window and the contents of the page magnified
* just enough to fit the entire width of the page within the window.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitHorizontally extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $top Top edge of displayed page
* @return Zend_Pdf_Destination_FitHorizontally
* @throws Zend_Pdf_Exception
*/
public static function create($page, $top)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitH');
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
return new Zend_Pdf_Destination_FitHorizontally($destinationArray);
}
/**
* Get top edge of the displayed page
*
* @return float
*/
public function getTopEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set top edge of the displayed page
*
* @param float $top
* @return Zend_Pdf_Action_FitHorizontally
*/
public function setTopEdge($top)
{
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($top);
return $this;
}
}

View File

@ -0,0 +1,165 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitRectangle.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitRectangle explicit detination
*
* Destination array: [page /FitR left bottom right top]
*
* Display the page designated by page, with its contents magnified just enough
* to fit the rectangle specified by the coordinates left, bottom, right, and top
* entirely within the window both horizontally and vertically. If the required
* horizontal and vertical magnification factors are different, use the smaller of
* the two, centering the rectangle within the window in the other dimension.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitRectangle extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @param float $bottom Bottom edge of displayed page
* @param float $right Right edge of displayed page
* @param float $top Top edge of displayed page
* @return Zend_Pdf_Destination_FitRectangle
* @throws Zend_Pdf_Exception
*/
public static function create($page, $left, $bottom, $right, $top)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitR');
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($bottom);
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($right);
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
return new Zend_Pdf_Destination_FitRectangle($destinationArray);
}
/**
* Get left edge of the displayed page
*
* @return float
*/
public function getLeftEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set left edge of the displayed page
*
* @param float $left
* @return Zend_Pdf_Action_FitRectangle
*/
public function setLeftEdge($left)
{
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
return $this;
}
/**
* Get bottom edge of the displayed page
*
* @return float
*/
public function getBottomEdge()
{
return $this->_destinationArray->items[3]->value;
}
/**
* Set bottom edge of the displayed page
*
* @param float $bottom
* @return Zend_Pdf_Action_FitRectangle
*/
public function setBottomEdge($bottom)
{
$this->_destinationArray->items[3] = new Zend_Pdf_Element_Numeric($bottom);
return $this;
}
/**
* Get right edge of the displayed page
*
* @return float
*/
public function getRightEdge()
{
return $this->_destinationArray->items[4]->value;
}
/**
* Set right edge of the displayed page
*
* @param float $right
* @return Zend_Pdf_Action_FitRectangle
*/
public function setRightEdge($right)
{
$this->_destinationArray->items[4] = new Zend_Pdf_Element_Numeric($right);
return $this;
}
/**
* Get top edge of the displayed page
*
* @return float
*/
public function getTopEdge()
{
return $this->_destinationArray->items[5]->value;
}
/**
* Set top edge of the displayed page
*
* @param float $top
* @return Zend_Pdf_Action_FitRectangle
*/
public function setTopEdge($top)
{
$this->_destinationArray->items[5] = new Zend_Pdf_Element_Numeric($top);
return $this;
}
}

View File

@ -0,0 +1,92 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FitVertically.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_FitVertically explicit detination
*
* Destination array: [page /FitV left]
*
* Display the page designated by page, with the horizontal coordinate left positioned
* at the left edge of the window and the contents of the page magnified
* just enough to fit the entire height of the page within the window.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_FitVertically extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @return Zend_Pdf_Destination_FitVertically
* @throws Zend_Pdf_Exception
*/
public static function create($page, $left)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('FitV');
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
return new Zend_Pdf_Destination_FitVertically($destinationArray);
}
/**
* Get left edge of the displayed page
*
* @return float
*/
public function getLeftEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set left edge of the displayed page
*
* @param float $left
* @return Zend_Pdf_Action_FitVertically
*/
public function setLeftEdge($left)
{
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
return $this;
}
}

View File

@ -0,0 +1,97 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Fit.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/**
* Destination array: [page /Fit]
*
* Display the page designated by page, with its contents magnified just enough
* to fit the entire page within the window both horizontally and vertically. If
* the required horizontal and vertical magnification factors are different, use
* the smaller of the two, centering the page within the window in the other
* dimension.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_Named extends Zend_Pdf_Destination
{
/**
* Destination name
*
* @var Zend_Pdf_Element_Name|Zend_Pdf_Element_String
*/
protected $_nameElement;
/**
* Named destination object constructor
*
* @param $resource
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $resource)
{
if ($resource->getType() != Zend_Pdf_Element::TYPE_NAME && $resource->getType() != Zend_Pdf_Element::TYPE_STRING) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Named destination resource must be a PDF name or a PDF string.');
}
$this->_nameElement = $resource;
}
/**
* Create named destination object
*
* @param string $name
* @return Zend_Pdf_Destination_Named
*/
public static function create($name)
{
return new Zend_Pdf_Destination_Named(new Zend_Pdf_Element_String($name));
}
/**
* Get name
*
* @return Zend_Pdf_Element
*/
public function getName()
{
return $this->_nameElement->value;
}
/**
* Get resource
*
* @internal
* @return Zend_Pdf_Element
*/
public function getResource()
{
return $this->_nameElement;
}
}

View File

@ -0,0 +1,37 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Unknown.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Unrecognized explicit destination representation class
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_Unknown extends Zend_Pdf_Destination_Explicit
{
}

View File

@ -0,0 +1,171 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Zoom.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_Destination_Explicit */
require_once 'Zend/Pdf/Destination/Explicit.php';
/**
* Zend_Pdf_Destination_Zoom explicit detination
*
* Destination array: [page /XYZ left top zoom]
*
* Display the page designated by page, with the coordinates (left, top) positioned
* at the upper-left corner of the window and the contents of the page
* magnified by the factor zoom. A null value for any of the parameters left, top,
* or zoom specifies that the current value of that parameter is to be retained unchanged.
* A zoom value of 0 has the same meaning as a null value.
*
* @package Zend_Pdf
* @subpackage Destination
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Destination_Zoom extends Zend_Pdf_Destination_Explicit
{
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @param float $top Top edge of displayed page
* @param float $zoom Zoom factor
* @return Zend_Pdf_Destination_Zoom
* @throws Zend_Pdf_Exception
*/
public static function create($page, $left = null, $top = null, $zoom = null)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('XYZ');
if ($left === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
}
if ($top === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
}
if ($zoom === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($zoom);
}
return new Zend_Pdf_Destination_Zoom($destinationArray);
}
/**
* Get left edge of the displayed page (null means viewer application 'current value')
*
* @return float
*/
public function getLeftEdge()
{
return $this->_destinationArray->items[2]->value;
}
/**
* Set left edge of the displayed page (null means viewer application 'current value')
*
* @param float $left
* @return Zend_Pdf_Action_Zoom
*/
public function setLeftEdge($left)
{
if ($left === null) {
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Null();
} else {
$this->_destinationArray->items[2] = new Zend_Pdf_Element_Numeric($left);
}
return $this;
}
/**
* Get top edge of the displayed page (null means viewer application 'current value')
*
* @return float
*/
public function getTopEdge()
{
return $this->_destinationArray->items[3]->value;
}
/**
* Set top edge of the displayed page (null means viewer application 'current viewer')
*
* @param float $top
* @return Zend_Pdf_Action_Zoom
*/
public function setTopEdge($top)
{
if ($top === null) {
$this->_destinationArray->items[3] = new Zend_Pdf_Element_Null();
} else {
$this->_destinationArray->items[3] = new Zend_Pdf_Element_Numeric($top);
}
return $this;
}
/**
* Get ZoomFactor of the displayed page (null or 0 means viewer application 'current value')
*
* @return float
*/
public function getZoomFactor()
{
return $this->_destinationArray->items[4]->value;
}
/**
* Set ZoomFactor of the displayed page (null or 0 means viewer application 'current viewer')
*
* @param float $zoom
* @return Zend_Pdf_Action_Zoom
*/
public function setZoomFactor($zoom)
{
if ($zoom === null) {
$this->_destinationArray->items[4] = new Zend_Pdf_Element_Null();
} else {
$this->_destinationArray->items[4] = new Zend_Pdf_Element_Numeric($zoom);
}
return $this;
}
}

View File

@ -12,15 +12,14 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Element.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_Element_Object */
require_once 'Zend/Pdf/Element/Object.php';
@ -29,7 +28,7 @@ require_once 'Zend/Pdf/Element/Object.php';
* PDF file element implementation
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Element
@ -75,9 +74,9 @@ abstract class Zend_Pdf_Element
*
* @param Zend_Pdf_Element_Object $parent
*/
public function setParentObject(Zend_Pdf_Element_Object &$parent)
public function setParentObject(Zend_Pdf_Element_Object $parent)
{
$this->_parentObject = &$parent;
$this->_parentObject = $parent;
}

View File

@ -14,38 +14,34 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Array.php 17532 2009-08-10 19:04:14Z alexander $
*/
/** Zend_Pdf_Element */
require_once 'Zend/Pdf/Element.php';
/** Zend_Pdf_PhpArray */
require_once 'Zend/Pdf/PhpArray.php';
/**
* PDF file 'array' element implementation
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Array extends Zend_Pdf_Element
{
/**
* Object value
* Array of Zend_Pdf_Element objects.
* Appropriate methods must (!) be used to modify it to provide correct
* work with objects and references.
* Array element items
*
* @var Zend_Pdf_PhpArray
* Array of Zend_Pdf_Element objects
*
* @var array
*/
private $_items;
public $items;
/**
@ -56,14 +52,14 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
*/
public function __construct($val = null)
{
$this->_items = new Zend_Pdf_PhpArray();
$this->items = new ArrayObject();
if ($val !== null && is_array($val)) {
foreach ($val as $element) {
if (!$element instanceof Zend_Pdf_Element) {
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
}
$this->_items[] = $element;
$this->items[] = $element;
}
} else if ($val !== null){
throw new Zend_Pdf_Exception('Argument must be an array');
@ -72,30 +68,27 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
/**
* Provides access to $this->_items
* Getter
*
* @param string $property
* @return Zend_Pdf_PhpArray
* @throws Zend_Pdf_Exception
*/
public function __get($property) {
if ($property=='items') {
return $this->_items;
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
* Provides read-only access to $this->_items;
* Setter
*
* @param unknown_type $offset
* @param unknown_type $value
* @param mixed $offset
* @param mixed $value
* @throws Zend_Pdf_Exception
*/
public function __set($property, $value) {
if ($property=='items') {
throw new Exception('Array container cannot be overwritten');
}
throw new Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
}
/**
@ -120,7 +113,7 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
$outStr = '[';
$lastNL = 0;
foreach ($this->_items as $element) {
foreach ($this->items as $element) {
if (strlen($outStr) - $lastNL > 128) {
$outStr .= "\n";
$lastNL = strlen($outStr);
@ -142,7 +135,9 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
*/
public function toPhp()
{
foreach ($this->_items as $item) {
$phpArray = array();
foreach ($this->items as $item) {
$phpArray[] = $item->toPhp();
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Boolean.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Dictionary.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Name.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Name extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Null.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Null extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Numeric.php 17182 2009-07-27 13:54:11Z alexander $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
@ -50,10 +51,11 @@ class Zend_Pdf_Element_Numeric extends Zend_Pdf_Element
public function __construct($val)
{
if ( !is_numeric($val) ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Argument must be numeric');
}
$this->value = $val;
$this->value = $val;
}

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Object.php 17182 2009-07-27 13:54:11Z alexander $
*/
@ -31,7 +32,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object extends Zend_Pdf_Element
@ -76,7 +77,7 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
{
if ($val instanceof self) {
throw new Zend_Pdf_Exception('Object number must not be instance of Zend_Pdf_Element_Object.');
throw new Zend_Pdf_Exception('Object number must not be an instance of Zend_Pdf_Element_Object.');
}
if ( !(is_integer($objNum) && $objNum > 0) ) {
@ -92,7 +93,9 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
$this->_genNum = $genNum;
$this->_factory = $factory;
$factory->registerObject($this);
$this->setParentObject($this);
$factory->registerObject($this, $objNum . ' ' . $genNum);
}
@ -205,20 +208,7 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
*/
public function __call($method, $args)
{
switch (count($args)) {
case 0:
return $this->_value->$method();
case 1:
return $this->_value->$method($args[0]);
case 2:
return $this->_value->$method($args[0], $args[1]);
case 3:
return $this->_value->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_value->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
return call_user_func_array(array($this->_value, $method), $args);
}
@ -230,6 +220,16 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
$this->_factory->markAsModified($this);
}
/**
* Return object, which can be used to identify object and its references identity
*
* @return Zend_Pdf_Element_Object
*/
public function getObject()
{
return $this;
}
/**
* Clean up resources, used by object
*/

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -46,7 +47,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Reference.php 17533 2009-08-10 19:06:27Z alexander $
*/
@ -37,7 +38,7 @@ require_once 'Zend/Pdf/ElementFactory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
@ -164,10 +165,12 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
*/
private function _dereference()
{
$obj = $this->_context->getParser()->getObject(
$this->_context->getRefTable()->getOffset($this->_objNum . ' ' . $this->_genNum . ' R'),
$this->_context
);
if (($obj = $this->_factory->fetchObject($this->_objNum . ' ' . $this->_genNum)) === null) {
$obj = $this->_context->getParser()->getObject(
$this->_context->getRefTable()->getOffset($this->_objNum . ' ' . $this->_genNum . ' R'),
$this->_context
);
}
if ($obj === null ) {
$this->_ref = new Zend_Pdf_Element_Null();
@ -179,9 +182,6 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
}
$this->_ref = $obj;
$this->setParentObject($obj);
$this->_factory->registerObject($this);
}
/**
@ -196,6 +196,19 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
$this->_ref->touch();
}
/**
* Return object, which can be used to identify object and its references identity
*
* @return Zend_Pdf_Element_Object
*/
public function getObject()
{
if ($this->_ref === null) {
$this->_dereference();
}
return $this->_ref;
}
/**
* Get handler
@ -240,20 +253,7 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
$this->_dereference();
}
switch (count($args)) {
case 0:
return $this->_ref->$method();
case 1:
return $this->_ref->$method($args[0]);
case 2:
return $this->_ref->$method($args[0], $args[1]);
case 3:
return $this->_ref->$method($args[0], $args[1], $args[2]);
case 4:
return $this->_ref->$method($args[0], $args[1], $args[2], $args[3]);
default:
throw new Zend_Pdf_Exception('Unsupported number of arguments');
}
return call_user_func_array(array($this->_ref, $method), $args);
}
/**

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Context.php 16978 2009-07-22 19:59:40Z alexander $
*/
@ -32,7 +33,7 @@ require_once 'Zend/Pdf/Element/Reference/Table.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Context
@ -68,7 +69,7 @@ class Zend_Pdf_Element_Reference_Context
/**
* Context parser
*
* @return Zend_Pdf_Parser
* @return Zend_Pdf_StringParser
*/
public function getParser()
{

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Table.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -24,7 +25,7 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Reference_Table

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -39,7 +40,7 @@ require_once 'Zend/Memory.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_Stream extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String extends Zend_Pdf_Element

View File

@ -14,8 +14,9 @@
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Binary.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -28,7 +29,7 @@ require_once 'Zend/Pdf/Element/String.php';
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Element_String_Binary extends Zend_Pdf_Element_String

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ElementFactory.php 17533 2009-08-10 19:06:27Z alexander $
*/
@ -69,7 +71,7 @@ require_once 'Zend/Pdf/UpdateInfoContainer.php';
* Responsibility is to log PDF changes
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
@ -89,9 +91,9 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
*
* Array: ojbectNumber => Zend_Pdf_Element_Object
*
* @var array
* @var SplObjectStorage
*/
private $_removedObjects = array();
private $_removedObjects;
/**
* List of registered objects.
@ -151,8 +153,9 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
*/
public function __construct($objCount)
{
$this->_objectCount = (int)$objCount;
$this->_factoryId = self::$_identity++;
$this->_objectCount = (int)$objCount;
$this->_factoryId = self::$_identity++;
$this->_removedObjects = new SplObjectStorage();
}
@ -255,7 +258,6 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
/**
* Calculate object enumeration shift.
*
* @internal
* @param Zend_Pdf_ElementFactory_Interface $factory
* @return integer
*/
@ -287,6 +289,22 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
return -1;
}
/**
* Clean enumeration shift cache.
* Has to be used after PDF render operation to let followed updates be correct.
*
* @param Zend_Pdf_ElementFactory_Interface $factory
* @return integer
*/
public function cleanEnumerationShiftCache()
{
$this->_shiftCalculationCache = array();
foreach ($this->_attachedFactories as $attached) {
$attached->cleanEnumerationShiftCache();
}
}
/**
* Retrive object enumeration shift.
*
@ -332,7 +350,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
}
$this->_modifiedObjects[$obj->getObjNum()] = $obj;
$this-> _removedObjects[$obj->getObjNum()] = $obj;
$this->_removedObjects->attach($obj);
}
@ -387,8 +405,8 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
$result = array();
foreach ($this->_modifiedObjects as $objNum => $obj) {
if (key_exists($objNum, $this->_removedObjects)) {
$result[$objNum+$shift] = new Zend_Pdf_UpdateInfoContainer($objNum + $shift,
if ($this->_removedObjects->contains($obj)) {
$result[$objNum+$shift] = new Zend_Pdf_UpdateInfoContainer($objNum + $shift,
$obj->getGenNum()+1,
true);
} else {
@ -411,13 +429,29 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
*
* It's used to clear "parent object" referencies when factory is closed and clean up resources
*
* @param string $refString
* @param Zend_Pdf_Element_Object $obj
*/
public function registerObject($obj)
public function registerObject(Zend_Pdf_Element_Object $obj, $refString)
{
$this->_registeredObjects[] = $obj;
$this->_registeredObjects[$refString] = $obj;
}
/**
* Fetch object specified by reference
*
* @param string $refString
* @return Zend_Pdf_Element_Object|null
*/
public function fetchObject($refString)
{
if (!isset($this->_registeredObjects[$refString])) {
return null;
}
return $this->_registeredObjects[$refString];
}
/**
* Check if PDF file was modified
*

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 17182 2009-07-27 13:54:11Z alexander $
*/
/**
@ -22,7 +24,7 @@
* Responsibility is to log PDF changes
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Pdf_ElementFactory_Interface
@ -72,12 +74,20 @@ interface Zend_Pdf_ElementFactory_Interface
/**
* Calculate object enumeration shift.
*
* @internal
* @param Zend_Pdf_ElementFactory_Interface $factory
* @return integer
*/
public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory);
/**
* Clean enumeration shift cache.
* Has to be used after PDF render operation to let followed updates be correct.
*
* @param Zend_Pdf_ElementFactory_Interface $factory
* @return integer
*/
public function cleanEnumerationShiftCache();
/**
* Retrive object enumeration shift.
*

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Proxy.php 17182 2009-07-27 13:54:11Z alexander $
*/
/** Zend_Pdf_ElementFactory_Interface */
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/ElementFactory/Interface.php';
* Responsibility is to log PDF changes
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
@ -127,6 +129,18 @@ class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
return $this->_factory->calculateShift($factory);
}
/**
* Clean enumeration shift cache.
* Has to be used after PDF render operation to let followed updates be correct.
*
* @param Zend_Pdf_ElementFactory_Interface $factory
* @return integer
*/
public function cleanEnumerationShiftCache()
{
return $this->_factory->cleanEnumerationShiftCache();
}
/**
* Retrive object enumeration shift.
*

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Core
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Exception */
@ -43,7 +45,7 @@ require_once 'Zend/Exception.php';
*
* @package Zend_Pdf
* @subpackage Core
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Exception extends Zend_Exception

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FileParser.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
@ -31,7 +33,7 @@
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_FileParser

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParser */
@ -30,7 +32,7 @@ require_once 'Zend/Pdf/FileParser.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_FileParser_Font extends Zend_Pdf_FileParser

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: OpenType.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParser_Font */
@ -47,7 +49,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Font

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TrueType.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParser_Font_OpenType */
@ -27,7 +29,7 @@ require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Font_OpenType

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Image.php 17182 2009-07-27 13:54:11Z alexander $
*/
/**
@ -28,16 +30,16 @@ require_once 'Zend/Pdf/FileParser.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_FileParser_Image extends Zend_Pdf_FileParser
{
/**
* Image Type
*
* @var integer
*/
/**
* Image Type
*
* @var integer
*/
protected $imageType;
/**
@ -54,4 +56,4 @@ abstract class Zend_Pdf_FileParser_Image extends Zend_Pdf_FileParser
$this->imageType = Zend_Pdf_Image::TYPE_UNKNOWN;
}
}
}

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Png.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_FileParser_Image */
@ -27,7 +29,7 @@ require_once 'Zend/Pdf/FileParser/Image.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FileParserDataSource.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
@ -33,7 +35,7 @@
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_FileParserDataSource

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParserDataSource */
@ -32,7 +34,7 @@ require_once 'Zend/Pdf/FileParserDataSource.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParserDataSource */
@ -28,7 +30,7 @@ require_once 'Zend/Pdf/FileParserDataSource.php';
*
* @package Zend_Pdf
* @subpackage FileParser
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Ascii85.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/Filter/Interface.php';
* ASCII85 stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Ascii85 implements Zend_Pdf_Filter_Interface

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: AsciiHex.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/Filter/Interface.php';
* AsciiHex stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_AsciiHex implements Zend_Pdf_Filter_Interface

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Compression.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/Filter/Interface.php';
* ASCII85 stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Flate.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/Filter/Compression.php';
* Flate stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Compression_Flate extends Zend_Pdf_Filter_Compression

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Lzw.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -26,7 +28,7 @@ require_once 'Zend/Pdf/Filter/Compression.php';
* LZW stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression

View File

@ -12,16 +12,18 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/**
* PDF stream filter
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Zend_Pdf_Filter_Interface

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_FileParserDataSource */
@ -97,7 +99,7 @@ require_once 'Zend/Pdf/Resource/Font/Extracted.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Font

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Images
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Image.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_FileParserDataSource */
@ -36,7 +38,7 @@ require_once 'Zend/Pdf/FileParserDataSource/String.php';
*
* @package Zend_Pdf
* @subpackage Images
* @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Image

154
libs/Zend/Pdf/NameTree.php Normal file
View File

@ -0,0 +1,154 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Action.php 16978 2009-07-22 19:59:40Z alexander $
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* PDF name tree representation class
*
* @todo implement lazy resource loading so resources will be really loaded at access time
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_NameTree implements ArrayAccess, Iterator, Countable
{
/**
* Elements
* Array of name => object tree entries
*
* @var array
*/
protected $_items = array();
/**
* Object constructor
*
* @param $rootDictionary root of name dictionary
*/
public function __construct(Zend_Pdf_Element $rootDictionary)
{
if ($rootDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Name tree root must be a dictionary.');
}
$intermediateNodes = array();
$leafNodes = array();
if ($rootDictionary->Kids !== null) {
$intermediateNodes[] = $rootDictionary;
} else {
$leafNodes[] = $rootDictionary;
}
while (count($intermediateNodes) != 0) {
$newIntermediateNodes = array();
foreach ($intermediateNodes as $node) {
foreach ($node->Kids->items as $childNode) {
if ($childNode->Kids !== null) {
$newIntermediateNodes[] = $childNode;
} else {
$leafNodes[] = $childNode;
}
}
}
$intermediateNodes = $newIntermediateNodes;
}
foreach ($leafNodes as $leafNode) {
$destinationsCount = count($leafNode->Names->items)/2;
for ($count = 0; $count < $destinationsCount; $count++) {
$this->_items[$leafNode->Names->items[$count*2]->value] = $leafNode->Names->items[$count*2 + 1];
}
}
}
public function current()
{
return current($this->_items);
}
public function next()
{
return next($this->_items);
}
public function key()
{
return key($this->_items);
}
public function valid() {
return current($this->_items)!==false;
}
public function rewind()
{
reset($this->_items);
}
public function offsetExists($offset)
{
return array_key_exists($offset, $this->_items);
}
public function offsetGet($offset)
{
return $this->_items[$offset];
}
public function offsetSet($offset, $value)
{
if ($offset === null) {
$this->_items[] = $value;
} else {
$this->_items[$offset] = $value;
}
}
public function offsetUnset($offset)
{
unset($this->_items[$offset]);
}
public function clear()
{
$this->_items = array();
}
public function count()
{
return count($this->_items);
}
}

376
libs/Zend/Pdf/Outline.php Normal file
View File

@ -0,0 +1,376 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/**
* Abstract PDF outline representation class
*
* @todo Implement an ability to associate an outline item with a structure element (PDF 1.3 feature)
*
* @package Zend_Pdf
* @subpackage Outlines
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Outline implements RecursiveIterator, Countable
{
/**
* True if outline is open.
*
* @var boolean
*/
protected $_open = false;
/**
* Array of child outlines (array of Zend_Pdf_Outline objects)
*
* @var array
*/
public $childOutlines = array();
/**
* Get outline title.
*
* @return string
*/
abstract public function getTitle();
/**
* Set outline title
*
* @param string $title
* @return Zend_Pdf_Outline
*/
abstract public function setTitle($title);
/**
* Returns true if outline item is open by default
*
* @return boolean
*/
public function isOpen()
{
return $this->_open;
}
/**
* Sets 'isOpen' outline flag
*
* @param boolean $isOpen
* @return Zend_Pdf_Outline
*/
public function setIsOpen($isOpen)
{
$this->_open = $isOpen;
return $this;
}
/**
* Returns true if outline item is displayed in italic
*
* @return boolean
*/
abstract public function isItalic();
/**
* Sets 'isItalic' outline flag
*
* @param boolean $isItalic
* @return Zend_Pdf_Outline
*/
abstract public function setIsItalic($isItalic);
/**
* Returns true if outline item is displayed in bold
*
* @return boolean
*/
abstract public function isBold();
/**
* Sets 'isBold' outline flag
*
* @param boolean $isBold
* @return Zend_Pdf_Outline
*/
abstract public function setIsBold($isBold);
/**
* Get outline text color.
*
* @return Zend_Pdf_Color_Rgb
*/
abstract public function getColor();
/**
* Set outline text color.
* (null means default color which is black)
*
* @param Zend_Pdf_Color_Rgb $color
* @return Zend_Pdf_Outline
*/
abstract public function setColor(Zend_Pdf_Color_Rgb $color);
/**
* Get outline target.
*
* @return Zend_Pdf_Target
*/
abstract public function getTarget();
/**
* Set outline target.
* Null means no target
*
* @param Zend_Pdf_Target|string $target
* @return Zend_Pdf_Outline
*/
abstract public function setTarget($target = null);
/**
* Get outline options
*
* @return array
*/
public function getOptions()
{
return array('title' => $this->_title,
'open' => $this->_open,
'color' => $this->_color,
'italic' => $this->_italic,
'bold' => $this->_bold,
'target' => $this->_target);
}
/**
* Set outline options
*
* @param array $options
* @return Zend_Pdf_Actions
* @throws Zend_Pdf_Exception
*/
public function setOptions(array $options)
{
foreach ($options as $key => $value) {
switch ($key) {
case 'title':
$this->setTitle($value);
break;
case 'open':
$this->setIsOpen($value);
break;
case 'color':
$this->setColor($value);
break;
case 'italic':
$this->setIsItalic($value);
break;
case 'bold':
$this->setIsBold($value);
break;
case 'target':
$this->setTarget($value);
break;
default:
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception("Unknown option name - '$key'.");
break;
}
}
return $this;
}
/**
* Create new Outline object
*
* It provides two forms of input parameters:
*
* 1. Zend_Pdf_Outline::create(string $title[, Zend_Pdf_Target $target])
* 2. Zend_Pdf_Outline::create(array $options)
*
* Second form allows to provide outline options as an array.
* The followed options are supported:
* 'title' - string, outline title, required
* 'open' - boolean, true if outline entry is open (default value is false)
* 'color' - Zend_Pdf_Color_Rgb object, true if outline entry is open (default value is null - black)
* 'italic' - boolean, true if outline entry is displayed in italic (default value is false)
* 'bold' - boolean, true if outline entry is displayed in bold (default value is false)
* 'target' - Zend_Pdf_Target object or string, outline item destination
*
* @return Zend_Pdf_Outline
* @throws Zend_Pdf_Exception
*/
public static function create($param1, $param2 = null)
{
if (is_string($param1)) {
if ($param2 !== null && !($param2 instanceof Zend_Pdf_Target || is_string($param2))) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $target (Zend_Pdf_Target or string) or an array as an input');
}
require_once 'Zend/Pdf/Outline/Created.php';
return new Zend_Pdf_Outline_Created(array('title' => $param1,
'target' => $param2));
} else {
if (!is_array($param1) || $param2 !== null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $destination (Zend_Pdf_Destination) or an array as an input');
}
return new Zend_Pdf_Outline_Created($param1);
}
}
/**
* Returns number of the total number of open items at all levels of the outline.
*
* @internal
* @return integer
*/
public function openOutlinesCount()
{
$count = 1; // Include this outline
if ($this->isOpen()) {
foreach ($this->childOutlines as $child) {
$count += $child->openOutlinesCount();
}
}
return $count;
}
/**
* Dump Outline and its child outlines into PDF structures
*
* Returns dictionary indirect object or reference
*
* @param Zend_Pdf_ElementFactory $factory object factory for newly created indirect objects
* @param boolean $updateNavigation Update navigation flag
* @param Zend_Pdf_Element $parent Parent outline dictionary reference
* @param Zend_Pdf_Element $prev Previous outline dictionary reference
* @param SplObjectStorage $processedOutlines List of already processed outlines
* @return Zend_Pdf_Element
*/
abstract public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
$updateNavigation,
Zend_Pdf_Element $parent,
Zend_Pdf_Element $prev = null,
SplObjectStorage $processedOutlines = null);
////////////////////////////////////////////////////////////////////////
// RecursiveIterator interface methods
//////////////
/**
* Returns the child outline.
*
* @return Zend_Pdf_Outline
*/
public function current()
{
return current($this->childOutlines);
}
/**
* Returns current iterator key
*
* @return integer
*/
public function key()
{
return key($this->childOutlines);
}
/**
* Go to next child
*/
public function next()
{
return next($this->childOutlines);
}
/**
* Rewind children
*/
public function rewind()
{
return reset($this->childOutlines);
}
/**
* Check if current position is valid
*
* @return boolean
*/
public function valid()
{
return current($this->childOutlines) !== false;
}
/**
* Returns the child outline.
*
* @return Zend_Pdf_Outline|null
*/
public function getChildren()
{
return current($this->childOutlines);
}
/**
* Implements RecursiveIterator interface.
*
* @return bool whether container has any pages
*/
public function hasChildren()
{
return count($this->childOutlines) > 0;
}
////////////////////////////////////////////////////////////////////////
// Countable interface methods
//////////////
/**
* count()
*
* @return int
*/
public function count()
{
return count($this->childOutlines);
}
}

View File

@ -0,0 +1,317 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/** Zend_Pdf_Outline */
require_once 'Zend/Pdf/Outline.php';
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* PDF outline representation class
*
* @todo Implement an ability to associate an outline item with a structure element (PDF 1.3 feature)
*
* @package Zend_Pdf
* @subpackage Outlines
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Outline_Created extends Zend_Pdf_Outline
{
/**
* Outline title.
*
* @var string
*/
protected $_title;
/**
* Color to be used for the outline entrys text.
* It uses the DeviceRGB color space for color representation.
* Null means default value - black ([0.0 0.0 0.0] in RGB representation).
*
* @var Zend_Pdf_Color_Rgb
*/
protected $_color = null;
/**
* True if outline item is displayed in italic.
* Default value is false.
*
* @var boolean
*/
protected $_italic = false;
/**
* True if outline item is displayed in bold.
* Default value is false.
*
* @var boolean
*/
protected $_bold = false;
/**
* Target destination or action.
* String means named destination
*
* Null means no target.
*
* @var Zend_Pdf_Destination|Zend_Pdf_Action
*/
protected $_target = null;
/**
* Get outline title.
*
* @return string
*/
public function getTitle()
{
return $this->_title;
}
/**
* Set outline title
*
* @param string $title
* @return Zend_Pdf_Outline
*/
public function setTitle($title)
{
$this->_title = $title;
return $this;
}
/**
* Returns true if outline item is displayed in italic
*
* @return boolean
*/
public function isItalic()
{
return $this->_italic;
}
/**
* Sets 'isItalic' outline flag
*
* @param boolean $isItalic
* @return Zend_Pdf_Outline
*/
public function setIsItalic($isItalic)
{
$this->_italic = $isItalic;
return $this;
}
/**
* Returns true if outline item is displayed in bold
*
* @return boolean
*/
public function isBold()
{
return $this->_bold;
}
/**
* Sets 'isBold' outline flag
*
* @param boolean $isBold
* @return Zend_Pdf_Outline
*/
public function setIsBold($isBold)
{
$this->_bold = $isBold;
return $this;
}
/**
* Get outline text color.
*
* @return Zend_Pdf_Color_Rgb
*/
public function getColor()
{
return $this->_color;
}
/**
* Set outline text color.
* (null means default color which is black)
*
* @param Zend_Pdf_Color_Rgb $color
* @return Zend_Pdf_Outline
*/
public function setColor(Zend_Pdf_Color_Rgb $color)
{
$this->_color = $color;
return $this;
}
/**
* Get outline target.
*
* @return Zend_Pdf_Target
*/
public function getTarget()
{
return $this->_target;
}
/**
* Set outline target.
* Null means no target
*
* @param Zend_Pdf_Target|string $target
* @return Zend_Pdf_Outline
* @throws Zend_Pdf_Exception
*/
public function setTarget($target = null)
{
if (is_string($target)) {
require_once 'Zend/Pdf/Destination/Named.php';
$target = new Zend_Pdf_Destination_Named($target);
}
if ($target === null || $target instanceof Zend_Pdf_Target) {
$this->_target = $target;
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline target has to be Zend_Pdf_Destination or Zend_Pdf_Action object or string');
}
return $this;
}
/**
* Object constructor
*
* @param array $options
* @throws Zend_Pdf_Exception
*/
public function __construct($options = array())
{
if (!isset($options['title'])) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Title parameter is required.');
}
$this->setOptions($options);
}
/**
* Dump Outline and its child outlines into PDF structures
*
* Returns dictionary indirect object or reference
*
* @internal
* @param Zend_Pdf_ElementFactory $factory object factory for newly created indirect objects
* @param boolean $updateNavigation Update navigation flag
* @param Zend_Pdf_Element $parent Parent outline dictionary reference
* @param Zend_Pdf_Element $prev Previous outline dictionary reference
* @param SplObjectStorage $processedOutlines List of already processed outlines
* @return Zend_Pdf_Element
* @throws Zend_Pdf_Exception
*/
public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
$updateNavigation,
Zend_Pdf_Element $parent,
Zend_Pdf_Element $prev = null,
SplObjectStorage $processedOutlines = null)
{
if ($processedOutlines === null) {
$processedOutlines = new SplObjectStorage();
}
$processedOutlines->attach($this);
$outlineDictionary = $factory->newObject(new Zend_Pdf_Element_Dictionary());
$outlineDictionary->Title = new Zend_Pdf_Element_String($this->getTitle());
$target = $this->getTarget();
if ($target === null) {
// Do nothing
} else if ($target instanceof Zend_Pdf_Destination) {
$outlineDictionary->Dest = $target->getResource();
} else if ($target instanceof Zend_Pdf_Action) {
$outlineDictionary->A = $target->getResource();
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline target has to be Zend_Pdf_Destination, Zend_Pdf_Action object or null');
}
$color = $this->getColor();
if ($color !== null) {
$components = $color->getComponents();
$colorComponentElements = array(new Zend_Pdf_Element_Numeric($components[0]),
new Zend_Pdf_Element_Numeric($components[1]),
new Zend_Pdf_Element_Numeric($components[2]));
$outlineDictionary->C = new Zend_Pdf_Element_Array($colorComponentElements);
}
if ($this->isItalic() || $this->isBold()) {
$outlineDictionary->F = new Zend_Pdf_Element_Numeric(($this->isItalic()? 1 : 0) | // Bit 1 - Italic
($this->isBold()? 2 : 0)); // Bit 2 - Bold
}
$outlineDictionary->Parent = $parent;
$outlineDictionary->Prev = $prev;
$lastChild = null;
foreach ($this->childOutlines as $childOutline) {
if ($processedOutlines->contains($childOutline)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
}
if ($lastChild === null) {
$lastChild = $childOutline->dumpOutline($factory, true, $outlineDictionary, null, $processedOutlines);
$outlineDictionary->First = $lastChild;
} else {
$childOutlineDictionary = $childOutline->dumpOutline($factory, true, $outlineDictionary, $lastChild, $processedOutlines);
$lastChild->Next = $childOutlineDictionary;
$lastChild = $childOutlineDictionary;
}
}
$outlineDictionary->Last = $lastChild;
if (count($this->childOutlines) != 0) {
$outlineDictionary->Count = new Zend_Pdf_Element_Numeric(($this->isOpen()? 1 : -1)*count($this->childOutlines));
}
return $outlineDictionary;
}
}

View File

@ -0,0 +1,462 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/** Zend_Pdf_ElementFactory */
require_once 'Zend/Pdf/ElementFactory.php';
/** Zend_Pdf_Outline */
require_once 'Zend/Pdf/Outline.php';
/** Zend_Pdf_Destination */
require_once 'Zend/Pdf/Destination.php';
/** Zend_Pdf_Action */
require_once 'Zend/Pdf/Action.php';
/**
* Traceable PDF outline representation class
*
* Instances of this class trace object update uperations. That allows to avoid outlines PDF tree update
* which should be performed at each document update otherwise.
*
* @package Zend_Pdf
* @subpackage Outlines
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline
{
/**
* Outline dictionary object
*
* @var Zend_Pdf_Element_Dictionary|Zend_Pdf_Element_Object|Zend_Pdf_Element_Reference
*/
protected $_outlineDictionary;
/**
* original array of child outlines
*
* @var array
*/
protected $_originalChildOutlines = array();
/**
* Get outline title.
*
* @return string
* @throws Zend_Pdf_Exception
*/
public function getTitle()
{
if ($this->_outlineDictionary->Title === null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline dictionary Title entry is required.');
}
return $this->_outlineDictionary->Title->value;
}
/**
* Set outline title
*
* @param string $title
* @return Zend_Pdf_Outline
*/
public function setTitle($title)
{
$this->_outlineDictionary->Title->touch();
$this->_outlineDictionary->Title = new Zend_Pdf_Element_String($title);
return $this;
}
/**
* Sets 'isOpen' outline flag
*
* @param boolean $isOpen
* @return Zend_Pdf_Outline
*/
public function setIsOpen($isOpen)
{
parent::setIsOpen($isOpen);
if ($this->_outlineDictionary->Count === null) {
// Do Nothing.
return this;
}
$childrenCount = $this->_outlineDictionary->Count->value;
$isOpenCurrentState = ($childrenCount > 0);
if ($isOpen != $isOpenCurrentState) {
$this->_outlineDictionary->Count->touch();
$this->_outlineDictionary->Count->value = ($isOpen? 1 : -1)*abs($childrenCount);
}
return $this;
}
/**
* Returns true if outline item is displayed in italic
*
* @return boolean
*/
public function isItalic()
{
if ($this->_outlineDictionary->F === null) {
return false;
}
return $this->_outlineDictionary->F->value & 1;
}
/**
* Sets 'isItalic' outline flag
*
* @param boolean $isItalic
* @return Zend_Pdf_Outline
*/
public function setIsItalic($isItalic)
{
if ($this->_outlineDictionary->F === null) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->F = new Zend_Pdf_Element_Numeric($isItalic? 1 : 0);
} else {
$this->_outlineDictionary->F->touch();
if ($isItalic) {
$this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | 1;
} else {
$this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | ~1;
}
}
return $this;
}
/**
* Returns true if outline item is displayed in bold
*
* @return boolean
*/
public function isBold()
{
if ($this->_outlineDictionary->F === null) {
return false;
}
return $this->_outlineDictionary->F->value & 2;
}
/**
* Sets 'isBold' outline flag
*
* @param boolean $isBold
* @return Zend_Pdf_Outline
*/
public function setIsBold($isBold)
{
if ($this->_outlineDictionary->F === null) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->F = new Zend_Pdf_Element_Numeric($isBold? 2 : 0);
} else {
$this->_outlineDictionary->F->touch();
if ($isBold) {
$this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | 2;
} else {
$this->_outlineDictionary->F->value = $this->_outlineDictionary->F->value | ~2;
}
}
return $this;
}
/**
* Get outline text color.
*
* @return Zend_Pdf_Color_Rgb
*/
public function getColor()
{
if ($this->_outlineDictionary->C === null) {
return null;
}
$components = $this->_outlineDictionary->C->items;
require_once 'Zend/Pdf/Color/Rgb.php';
return new Zend_Pdf_Color_Rgb($components[0], $components[1], $components[2]);
}
/**
* Set outline text color.
* (null means default color which is black)
*
* @param Zend_Pdf_Color_Rgb $color
* @return Zend_Pdf_Outline
*/
public function setColor(Zend_Pdf_Color_Rgb $color)
{
$this->_outlineDictionary->touch();
if ($color === null) {
$this->_outlineDictionary->C = null;
} else {
$components = $color->getComponents();
$colorComponentElements = array(new Zend_Pdf_Element_Numeric($components[0]),
new Zend_Pdf_Element_Numeric($components[1]),
new Zend_Pdf_Element_Numeric($components[2]));
$this->_outlineDictionary->C = new Zend_Pdf_Element_Array($colorComponentElements);
}
return $this;
}
/**
* Get outline target.
*
* @return Zend_Pdf_Target
* @thows Zend_Pdf_Exception
*/
public function getTarget()
{
if ($this->_outlineDictionary->Dest !== null) {
if ($this->_outlineDictionary->A !== null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline dictionary may contain Dest or A entry, but not both.');
}
return Zend_Pdf_Destination::load($this->_outlineDictionary->Dest);
} else if ($this->_outlineDictionary->A !== null) {
return Zend_Pdf_Action::load($this->_outlineDictionary->A);
}
return null;
}
/**
* Set outline target.
* Null means no target
*
* @param Zend_Pdf_Target|string $target
* @return Zend_Pdf_Outline
* @throws Zend_Pdf_Exception
*/
public function setTarget($target = null)
{
$this->_outlineDictionary->touch();
if (is_string($target)) {
require_once 'Zend/Pdf/Destination/Named.php';
$target = Zend_Pdf_Destination_Named::create($target);
}
if ($target === null) {
$this->_outlineDictionary->Dest = null;
$this->_outlineDictionary->A = null;
} else if ($target instanceof Zend_Pdf_Destination) {
$this->_outlineDictionary->Dest = $target->getResource();
$this->_outlineDictionary->A = null;
} else if ($target instanceof Zend_Pdf_Action) {
$this->_outlineDictionary->Dest = null;
$this->_outlineDictionary->A = $target->getResource();
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline target has to be Zend_Pdf_Destination or Zend_Pdf_Action object or string');
}
return $this;
}
/**
* Set outline options
*
* @param array $options
* @return Zend_Pdf_Actions_Traceable
* @throws Zend_Pdf_Exception
*/
public function setOptions(array $options)
{
parent::setOptions($options);
return $this;
}
/**
* Create PDF outline object using specified dictionary
*
* @internal
* @param Zend_Pdf_Element $dictionary (It's actually Dictionary or Dictionary Object or Reference to a Dictionary Object)
* @param Zend_Pdf_Action $parentAction
* @param SplObjectStorage $processedOutlines List of already processed Outline dictionaries,
* used to avoid cyclic references
* @return Zend_Pdf_Action
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $dictionary, SplObjectStorage $processedDictionaries = null)
{
if ($dictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('$dictionary mast be an indirect dictionary object.');
}
if ($processedDictionaries === null) {
$processedDictionaries = new SplObjectStorage();
}
$processedDictionaries->attach($dictionary);
$this->_outlineDictionary = $dictionary;
if ($dictionary->Count !== null) {
if ($dictionary->Count->getType() != Zend_Pdf_Element::TYPE_NUMERIC) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline dictionary Count entry must be a numeric element.');
}
$childOutlinesCount = $dictionary->Count->value;
if ($childOutlinesCount > 0) {
$this->_open = true;
}
$childOutlinesCount = abs($childOutlinesCount);
$childDictionary = $dictionary->First;
for ($count = 0; $count < $childOutlinesCount; $count++) {
if ($childDictionary === null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline childs load error.');
}
if (!$processedDictionaries->contains($childDictionary)) {
$this->childOutlines[] = new Zend_Pdf_Outline_Loaded($childDictionary, $processedDictionaries);
}
$childDictionary = $childDictionary->Next;
}
if ($childDictionary !== null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outline childs load error.');
}
$this->_originalChildOutlines = $this->childOutlines;
}
}
/**
* Dump Outline and its child outlines into PDF structures
*
* Returns dictionary indirect object or reference
*
* @internal
* @param Zend_Pdf_ElementFactory $factory object factory for newly created indirect objects
* @param boolean $updateNavigation Update navigation flag
* @param Zend_Pdf_Element $parent Parent outline dictionary reference
* @param Zend_Pdf_Element $prev Previous outline dictionary reference
* @param SplObjectStorage $processedOutlines List of already processed outlines
* @return Zend_Pdf_Element
* @throws Zend_Pdf_Exception
*/
public function dumpOutline(Zend_Pdf_ElementFactory_Interface $factory,
$updateNavigation,
Zend_Pdf_Element $parent,
Zend_Pdf_Element $prev = null,
SplObjectStorage $processedOutlines = null)
{
if ($processedOutlines === null) {
$processedOutlines = new SplObjectStorage();
}
$processedOutlines->attach($this);
if ($updateNavigation) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->Parent = $parent;
$this->_outlineDictionary->Prev = $prev;
$this->_outlineDictionary->Next = null;
}
$updateChildNavigation = false;
if (count($this->_originalChildOutlines) != count($this->childOutlines)) {
// If original and current children arrays have different size then children list was updated
$updateChildNavigation = true;
} else if ( !(array_keys($this->_originalChildOutlines) === array_keys($this->childOutlines)) ) {
// If original and current children arrays have different keys (with a glance to an order) then children list was updated
$updateChildNavigation = true;
} else {
foreach ($this->childOutlines as $key => $childOutline) {
if ($this->_originalChildOutlines[$key] !== $childOutline) {
$updateChildNavigation = true;
break;
}
}
}
$lastChild = null;
if ($updateChildNavigation) {
$this->_outlineDictionary->touch();
$this->_outlineDictionary->First = null;
foreach ($this->childOutlines as $childOutline) {
if ($processedOutlines->contains($childOutline)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
}
if ($lastChild === null) {
// First pass. Update Outlines dictionary First entry using corresponding value
$lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, null, $processedOutlines);
$this->_outlineDictionary->First = $lastChild;
} else {
// Update previous outline dictionary Next entry (Prev is updated within dumpOutline() method)
$childOutlineDictionary = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
$lastChild->Next = $childOutlineDictionary;
$lastChild = $childOutlineDictionary;
}
}
$this->_outlineDictionary->Last = $lastChild;
if (count($this->childOutlines) != 0) {
$this->_outlineDictionary->Count = new Zend_Pdf_Element_Numeric(($this->isOpen()? 1 : -1)*count($this->childOutlines));
} else {
$this->_outlineDictionary->Count = null;
}
} else {
foreach ($this->childOutlines as $childOutline) {
if ($processedOutlines->contains($childOutline)) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Outlines cyclyc reference is detected.');
}
$lastChild = $childOutline->dumpOutline($factory, $updateChildNavigation, $this->_outlineDictionary, $lastChild, $processedOutlines);
}
}
return $this->_outlineDictionary;
}
public function dump($level = 0)
{
printf(":%3d:%s:%s:%s%s :\n", count($this->childOutlines),$this->isItalic()? 'i':' ', $this->isBold()? 'b':' ', str_pad('', 4*$level), $this->getTitle());
if ($this->isOpen() || true) {
foreach ($this->childOutlines as $child) {
$child->dump($level + 1);
}
}
}
}

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Page.php 17532 2009-08-10 19:04:14Z alexander $
*/
/** Zend_Pdf_Resource_Font */
@ -44,11 +46,14 @@ require_once 'Zend/Pdf/Color/Rgb.php';
/** Zend_Pdf_Color_Cmyk */
require_once 'Zend/Pdf/Color/Cmyk.php';
/** Zend_Pdf_Annotation */
require_once 'Zend/Pdf/Annotation.php';
/**
* PDF Page
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Page
@ -120,9 +125,9 @@ class Zend_Pdf_Page
/**
* Reference to the object with page dictionary.
* Page dictionary (refers to an inderect Zend_Pdf_Element_Dictionary object).
*
* @var Zend_Pdf_Element_Reference
* @var Zend_Pdf_Element_Reference|Zend_Pdf_Element_Object
*/
protected $_pageDictionary;
@ -142,7 +147,7 @@ class Zend_Pdf_Page
protected $_attached;
/**
* Stream of the drawing instractions.
* Stream of the drawing instructions.
*
* @var string
*/
@ -412,6 +417,7 @@ class Zend_Pdf_Page
/**
* Retrive PDF file reference to the page
*
* @internal
* @return Zend_Pdf_Element_Dictionary
*/
public function getPageDictionary()
@ -723,6 +729,7 @@ class Zend_Pdf_Page
* returns array of Zend_Pdf_Resource_Font_Extracted objects
*
* @return array
* @throws Zend_Pdf_Exception
*/
public function extractFonts()
{
@ -740,21 +747,21 @@ class Zend_Pdf_Page
if (! ($fontDictionary instanceof Zend_Pdf_Element_Reference ||
$fontDictionary instanceof Zend_Pdf_Element_Object) ) {
// Font dictionary has to be an indirect object or object reference
continue;
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Font dictionary has to be an indirect object or object reference.');
}
$fontResourcesUnique[$fontDictionary->toString($this->_objFactory)] = $fontDictionary;
$fontResourcesUnique[spl_object_hash($fontDictionary->getObject())] = $fontDictionary;
}
$fonts = array();
require_once 'Zend/Pdf/Exception.php';
foreach ($fontResourcesUnique as $resourceReference => $fontDictionary) {
foreach ($fontResourcesUnique as $resourceId => $fontDictionary) {
try {
// Try to extract font
$extractedFont = new Zend_Pdf_Resource_Font_Extracted($fontDictionary);
$fonts[$resourceReference] = $extractedFont;
$fonts[$resourceId] = $extractedFont;
} catch (Zend_Pdf_Exception $e) {
if ($e->getMessage() != 'Unsupported font type.') {
throw $e;
@ -771,6 +778,7 @@ class Zend_Pdf_Page
* $fontName should be specified in UTF-8 encoding
*
* @return Zend_Pdf_Resource_Font_Extracted|null
* @throws Zend_Pdf_Exception
*/
public function extractFont($fontName)
{
@ -781,14 +789,24 @@ class Zend_Pdf_Page
$fontResources = $this->_pageDictionary->Resources->Font;
$fontResourcesUnique = array();
require_once 'Zend/Pdf/Exception.php';
foreach ($fontResources->getKeys() as $fontResourceName) {
$fontDictionary = $fontResources->$fontResourceName;
if (! ($fontDictionary instanceof Zend_Pdf_Element_Reference ||
$fontDictionary instanceof Zend_Pdf_Element_Object) ) {
// Font dictionary has to be an indirect object or object reference
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Font dictionary has to be an indirect object or object reference.');
}
$resourceId = spl_object_hash($fontDictionary->getObject());
if (isset($fontResourcesUnique[$resourceId])) {
continue;
} else {
// Mark resource as processed
$fontResourcesUnique[$resourceId] = 1;
}
if ($fontDictionary->BaseFont->value != $fontName) {
@ -1423,6 +1441,34 @@ class Zend_Pdf_Page
return $this;
}
/**
*
* @param Zend_Pdf_Annotation $annotation
* @return Zend_Pdf_Page
*/
public function attachAnnotation(Zend_Pdf_Annotation $annotation)
{
$annotationDictionary = $annotation->getResource();
if (!$annotationDictionary instanceof Zend_Pdf_Element_Object &&
!$annotationDictionary instanceof Zend_Pdf_Element_Reference) {
$annotationDictionary = $this->_objFactory->newObject($annotationDictionary);
}
if ($this->_pageDictionary->Annots === null) {
$this->_pageDictionary->touch();
$this->_pageDictionary->Annots = new Zend_Pdf_Element_Array();
} else {
$this->_pageDictionary->Annots->touch();
}
$this->_pageDictionary->Annots->items[] = $annotationDictionary;
$annotationDictionary->touch();
$annotationDictionary->P = $this->_pageDictionary;
return $this;
}
/**
* Return the height of this page in points.
*

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Parser.php 17530 2009-08-10 18:47:29Z alexander $
*/
/** Zend_Pdf_Element */
@ -65,21 +67,15 @@ require_once 'Zend/Pdf/Trailer/Keeper.php';
/** Zend_Pdf_ElementFactory_Interface */
require_once 'Zend/Pdf/ElementFactory/Interface.php';
/** Zend_Pdf_PhpArray */
require_once 'Zend/Pdf/PhpArray.php';
/** Zend_Pdf_StringParser */
require_once 'Zend/Pdf/StringParser.php';
/** Zend_Pdf_Parser_Stream */
require_once 'Zend/Pdf/Parser/Stream.php';
/**
* PDF file parser
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Parser
@ -98,6 +94,13 @@ class Zend_Pdf_Parser
*/
private $_trailer;
/**
* PDF version specified in the file header
*
* @var string
*/
private $_pdfVersion;
/**
* Get length of source PDF
@ -119,6 +122,16 @@ class Zend_Pdf_Parser
return $this->_stringParser->data;
}
/**
* PDF version specified in the file header
*
* @return string
*/
public function getPDFVersion()
{
return $this->_pdfVersion;
}
/**
* Load XReference table and referenced objects
*
@ -398,8 +411,10 @@ class Zend_Pdf_Parser
throw new Zend_Pdf_Exception('File is not a PDF.');
}
$pdfVersion = (float)substr($pdfVersionComment, 5);
if ($pdfVersion < 0.9 || $pdfVersion >= 1.61) {
$pdfVersion = substr($pdfVersionComment, 5);
if (version_compare($pdfVersion, '0.9', '<') ||
version_compare($pdfVersion, '1.61', '>=')
) {
/**
* @todo
* To support PDF versions 1.5 (Acrobat 6) and PDF version 1.7 (Acrobat 7)
@ -408,6 +423,7 @@ class Zend_Pdf_Parser
*/
throw new Zend_Pdf_Exception(sprintf('Unsupported PDF version. Zend_Pdf supports PDF 1.0-1.4. Current version - \'%f\'', $pdfVersion));
}
$this->_pdfVersion = $pdfVersion;
$this->_stringParser->offset = strrpos($this->_stringParser->data, '%%EOF');
if ($this->_stringParser->offset === false ||

View File

@ -1,59 +0,0 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Parser */
require_once 'Zend/Pdf/Parser.php';
/**
* PDF object stream parser
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Parser_Stream extends Zend_Pdf_Parser
{
/**
* Get Trailer object
*
* @return Zend_Pdf_Trailer_Keeper
*/
public function getTrailer()
{
throw new Zend_Pdf_Exception('Stream object parser doesn\'t contain trailer information.');
}
/**
* Object constructor
*
* @param string $pdfString
* @param Zend_Pdf_ElementFactory $factory
* @throws Zend_Exception
*/
public function __construct(&$source, Zend_Pdf_ElementFactory $factory)
{
$this->_current = 0;
$this->_currentContext = null;
$this->_contextStack = array();
$this->_elements = new Zend_Pdf_PhpArray();
$this->_objFactory = $factory;
}
}

View File

@ -1,128 +0,0 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* PHP Array (OO wrapper)
* Used to be returned by reference by __get() methods
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @todo also implement Countable for PHP 5.1 but not yet to stay 5.0 compatible
*/
class Zend_Pdf_PhpArray implements ArrayAccess, Iterator, Countable {
/**
* Array element
* @var mixed
*/
protected $_items = array();
/**
* Object constructor
*
* @param array $srcArray
*/
public function __construct($srcArray = null)
{
if ($srcArray === null) {
reset($this->_items);
} else if (is_array($srcArray)) {
$this->_items = $srcArray;
} else {
throw new Exception('Array can be initialized only by other array');
}
}
public function current()
{
return current($this->_items);
}
public function next()
{
return next($this->_items);
}
public function key()
{
return key($this->_items);
}
public function valid() {
return current($this->_items)!==false;
}
public function rewind()
{
reset($this->_items);
}
public function offsetExists($offset)
{
return array_key_exists($offset, $this->_items);
}
public function offsetGet($offset)
{
return $this->_items[$offset];
}
public function offsetSet($offset, $value)
{
if ($offset === null) {
$this->_items[] = $value;
} else {
$this->_items[$offset] = $value;
}
}
public function offsetUnset($offset)
{
unset($this->_items[$offset]);
}
public function clear()
{
$this->_items = array();
}
/**
* Defined by Countable interface
*
* @return int
*/
public function count()
{
return count($this->_items);
}
}

View File

@ -0,0 +1,45 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Actions
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* Iteratable objects container
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_RecursivelyIteratableObjectsContainer implements RecursiveIterator, Countable
{
protected $_objects = array();
public function __construct(array $objects) { $this->_objects = $objects; }
public function current() { return current($this->_objects); }
public function key() { return key($this->_objects); }
public function next() { return next($this->_objects); }
public function rewind() { return reset($this->_objects); }
public function valid() { return current($this->_objects) !== false; }
public function getChildren() { return current($this->_objects); }
public function hasChildren() { return count($this->_objects) > 0; }
public function count() { return count($this->_objects); }
}

View File

@ -12,9 +12,11 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Resource.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
@ -32,7 +34,7 @@ require_once 'Zend/Pdf/Element/Dictionary.php';
* PDF file Resource abstraction
*
* @package Zend_Pdf
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Resource

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Resource */
@ -34,7 +36,7 @@ require_once 'Zend/Pdf/Resource.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Resource_Font extends Zend_Pdf_Resource

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: CidFont.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Resource_Font */
@ -49,7 +51,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TrueType.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Resource_Font_CidFont */
@ -37,7 +39,7 @@ require_once 'Zend/Pdf/Resource/Font/FontDescriptor.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Resource_Font_CidFont_TrueType extends Zend_Pdf_Resource_Font_CidFont

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Extracted.php 17530 2009-08-10 18:47:29Z alexander $
*/
/** Zend_Pdf_Resource_Font */
@ -28,29 +30,29 @@ require_once 'Zend/Pdf/Cmap.php';
/**
* Extracted fonts implementation
*
*
* Thes class allows to extract fonts already mentioned within PDF document and use them
* for text drawing.
*
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
{
/**
* Extracted font encoding
*
*
* Only 'Identity-H' and 'WinAnsiEncoding' encodings are supported now
*
*
* @var string
*/
protected $_encoding = null;
/**
* Object constructor
*
*
* $fontDictionary is a Zend_Pdf_Element_Reference or Zend_Pdf_Element_Object object
*
* @param mixed $fontDictionary
@ -58,36 +60,35 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
*/
public function __construct($fontDictionary)
{
// Extract object factory and resource object from font dirctionary object
// Extract object factory and resource object from font dirctionary object
$this->_objectFactory = $fontDictionary->getFactory();
$this->_resource = $fontDictionary;
if ($fontDictionary->Encoding !== null) {
$this->_encoding = $fontDictionary->Encoding->value;
}
}
switch ($fontDictionary->Subtype->value) {
case 'Type0':
// Composite type 0 font
if ($fontDictionary->DescendantFonts->items->count() != 1) {
if (count($fontDictionary->DescendantFonts->items) != 1) {
// Multiple descendant fonts are not supported
throw new Zend_Pdf_Exception('Unsupported font type.');
}
$descFontsArrayItems = $fontDictionary->DescendantFonts->items;
$descFontsArrayItems->rewind();
$descendantFont = $descFontsArrayItems->current();
$fontDictionaryIterator = $fontDictionary->DescendantFonts->items->getIterator();
$fontDictionaryIterator->rewind();
$descendantFont = $fontDictionaryIterator->current();
$fontDescriptor = $descendantFont->FontDescriptor;
break;
case 'Type1':
if ($fontDictionary->FontDescriptor === null) {
// That's one of the standard fonts
$standardFont = Zend_Pdf_Font::fontWithName($fontDictionary->BaseFont->value);
$this->_fontNames = $standardFont->getFontNames();
$this->_isBold = $standardFont->isBold();
$this->_isBold = $standardFont->isBold();
$this->_isItalic = $standardFont->isItalic();
$this->_isMonospace = $standardFont->isMonospace();
$this->_underlinePosition = $standardFont->getUnderlinePosition();
@ -108,14 +109,14 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
case 'TrueType':
$fontDescriptor = $fontDictionary->FontDescriptor;
break;
default:
throw new Zend_Pdf_Exception('Unsupported font type.');
throw new Zend_Pdf_Exception('Unsupported font type.');
}
$this->_fontNames[Zend_Pdf_Font::NAME_POSTSCRIPT]['en'] = iconv('UTF-8', 'UTF-16BE', $fontDictionary->BaseFont->value);
$this->_isBold = false; // this property is actually not used anywhere
$this->_isBold = false; // this property is actually not used anywhere
$this->_isItalic = ( ($fontDescriptor->Flags->value & (1 << 6)) != 0 ); // Bit-7 is set
$this->_isMonospace = ( ($fontDescriptor->Flags->value & (1 << 0)) != 0 ); // Bit-1 is set
$this->_underlinePosition = null; // Can't be extracted
@ -214,11 +215,11 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
{
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
}
/**
* Convert string to the font encoding.
*
* The method is used to prepare string for text drawing operators
*
* The method is used to prepare string for text drawing operators
*
* @param string $string
* @param string $charEncoding Character encoding of source text.
@ -229,11 +230,11 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
if ($this->_encoding == 'Identity-H') {
return iconv($charEncoding, 'UTF-16BE', $string);
}
if ($this->_encoding == 'WinAnsiEncoding') {
return iconv($charEncoding, 'CP1252//IGNORE', $string);
}
throw new Zend_Pdf_Exception('Fonf encoding is not supported');
}
@ -251,11 +252,11 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
if ($this->_encoding == 'Identity-H') {
return iconv('UTF-16BE', $charEncoding, $string);
}
if ($this->_encoding == 'WinAnsiEncoding') {
return iconv('CP1252', $charEncoding, $string);
}
throw new Zend_Pdf_Exception('Fonf encoding is not supported');
}
}

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FontDescriptor.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Font */
@ -39,7 +41,7 @@ require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Resource_Font_FontDescriptor

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Simple.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Resource_Font */
@ -54,7 +56,7 @@ require_once 'Zend/Pdf/Cmap.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Resource_Font_Simple extends Zend_Pdf_Resource_Font

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Parsed.php 16971 2009-07-22 18:05:45Z mikaelkael $
*/
/** Zend_Pdf_Resource_Font_Simple */
@ -32,7 +34,7 @@ require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Pdf_Resource_Font_Simple_Parsed extends Zend_Pdf_Resource_Font_Simple

View File

@ -12,10 +12,12 @@
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: TrueType.php 16541 2009-07-07 06:59:03Z bkarwin $
*/
/** Zend_Pdf_Resource_Font_Simple_Parsed */
@ -34,7 +36,7 @@ require_once 'Zend/Pdf/Resource/Font/FontDescriptor.php';
*
* @package Zend_Pdf
* @subpackage Fonts
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Resource_Font_Simple_Parsed_TrueType extends Zend_Pdf_Resource_Font_Simple_Parsed

Some files were not shown because too many files have changed in this diff Show More