first commit
This commit is contained in:
404
modules/ruch/libraries/Zend/Pdf/Action.php
Normal file
404
modules/ruch/libraries/Zend/Pdf/Action.php
Normal file
@@ -0,0 +1,404 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Action.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Target */
|
||||
require_once 'Zend/Pdf/Target.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract PDF action representation class
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2011 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)
|
||||
{
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
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();
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
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);
|
||||
break;
|
||||
|
||||
case 'GoToR':
|
||||
require_once 'Zend/Pdf/Action/GoToR.php';
|
||||
return new Zend_Pdf_Action_GoToR($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'GoToE':
|
||||
require_once 'Zend/Pdf/Action/GoToE.php';
|
||||
return new Zend_Pdf_Action_GoToE($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Launch':
|
||||
require_once 'Zend/Pdf/Action/Launch.php';
|
||||
return new Zend_Pdf_Action_Launch($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Thread':
|
||||
require_once 'Zend/Pdf/Action/Thread.php';
|
||||
return new Zend_Pdf_Action_Thread($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'URI':
|
||||
require_once 'Zend/Pdf/Action/URI.php';
|
||||
return new Zend_Pdf_Action_URI($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Sound':
|
||||
require_once 'Zend/Pdf/Action/Sound.php';
|
||||
return new Zend_Pdf_Action_Sound($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Movie':
|
||||
require_once 'Zend/Pdf/Action/Movie.php';
|
||||
return new Zend_Pdf_Action_Movie($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Hide':
|
||||
require_once 'Zend/Pdf/Action/Hide.php';
|
||||
return new Zend_Pdf_Action_Hide($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Named':
|
||||
require_once 'Zend/Pdf/Action/Named.php';
|
||||
return new Zend_Pdf_Action_Named($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'SubmitForm':
|
||||
require_once 'Zend/Pdf/Action/SubmitForm.php';
|
||||
return new Zend_Pdf_Action_SubmitForm($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'ResetForm':
|
||||
require_once 'Zend/Pdf/Action/ResetForm.php';
|
||||
return new Zend_Pdf_Action_ResetForm($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'ImportData':
|
||||
require_once 'Zend/Pdf/Action/ImportData.php';
|
||||
return new Zend_Pdf_Action_ImportData($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'JavaScript':
|
||||
require_once 'Zend/Pdf/Action/JavaScript.php';
|
||||
return new Zend_Pdf_Action_JavaScript($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'SetOCGState':
|
||||
require_once 'Zend/Pdf/Action/SetOCGState.php';
|
||||
return new Zend_Pdf_Action_SetOCGState($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Rendition':
|
||||
require_once 'Zend/Pdf/Action/Rendition.php';
|
||||
return new Zend_Pdf_Action_Rendition($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'Trans':
|
||||
require_once 'Zend/Pdf/Action/Trans.php';
|
||||
return new Zend_Pdf_Action_Trans($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
case 'GoTo3DView':
|
||||
require_once 'Zend/Pdf/Action/GoTo3DView.php';
|
||||
return new Zend_Pdf_Action_GoTo3DView($dictionary, $processedActions);
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Action/Unknown.php';
|
||||
return new Zend_Pdf_Action_Unknown($dictionary, $processedActions);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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:
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
$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_Action|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);
|
||||
}
|
||||
}
|
||||
116
modules/ruch/libraries/Zend/Pdf/Action/GoTo.php
Normal file
116
modules/ruch/libraries/Zend/Pdf/Action/GoTo.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GoTo.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
/**
|
||||
* PDF 'Go to' action
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @param Zend_Pdf_Destination|string $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;
|
||||
}
|
||||
}
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/GoTo3DView.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/GoTo3DView.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GoTo3DView.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/GoToE.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/GoToE.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GoToE.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/GoToR.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/GoToR.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GoToR.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/Hide.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/Hide.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Hide.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF 'Set an annotation’s Hidden flag' action
|
||||
* PDF 1.2+ feature
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/ImportData.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/ImportData.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ImportData.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/JavaScript.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/JavaScript.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: JavaScript.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/Launch.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/Launch.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Launch.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/Movie.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/Movie.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Movie.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/Named.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/Named.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Named.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/Rendition.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/Rendition.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Rendition.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/ResetForm.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/ResetForm.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ResetForm.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/SetOCGState.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/SetOCGState.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SetOCGState.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/Sound.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/Sound.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Sound.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/SubmitForm.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/SubmitForm.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SubmitForm.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/Thread.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/Thread.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Thread.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
39
modules/ruch/libraries/Zend/Pdf/Action/Trans.php
Normal file
39
modules/ruch/libraries/Zend/Pdf/Action/Trans.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Trans.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
167
modules/ruch/libraries/Zend/Pdf/Action/URI.php
Normal file
167
modules/ruch/libraries/Zend/Pdf/Action/URI.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: URI.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF 'Resolve a uniform resource identifier' action
|
||||
*
|
||||
* A URI action causes a URI to be resolved.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* 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);
|
||||
|
||||
if ($dictionary->URI === null) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('URI action dictionary entry is required');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate URI
|
||||
*
|
||||
* @param string $uri
|
||||
* @return true
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected static function _validateUri($uri)
|
||||
{
|
||||
$scheme = parse_url((string)$uri, PHP_URL_SCHEME);
|
||||
if ($scheme === false || $scheme === null) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid URI');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new Zend_Pdf_Action_URI object using specified uri
|
||||
*
|
||||
* @param string $uri The URI to resolve, encoded in 7-bit ASCII
|
||||
* @param boolean $isMap A flag specifying whether to track the mouse position when the URI is resolved
|
||||
* @return Zend_Pdf_Action_URI
|
||||
*/
|
||||
public static function create($uri, $isMap = false)
|
||||
{
|
||||
self::_validateUri($uri);
|
||||
|
||||
$dictionary = new Zend_Pdf_Element_Dictionary();
|
||||
$dictionary->Type = new Zend_Pdf_Element_Name('Action');
|
||||
$dictionary->S = new Zend_Pdf_Element_Name('URI');
|
||||
$dictionary->Next = null;
|
||||
$dictionary->URI = new Zend_Pdf_Element_String($uri);
|
||||
if ($isMap) {
|
||||
$dictionary->IsMap = new Zend_Pdf_Element_Boolean(true);
|
||||
}
|
||||
|
||||
return new Zend_Pdf_Action_URI($dictionary, new SplObjectStorage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set URI to resolve
|
||||
*
|
||||
* @param string $uri The uri to resolve, encoded in 7-bit ASCII.
|
||||
* @return Zend_Pdf_Action_URI
|
||||
*/
|
||||
public function setUri($uri)
|
||||
{
|
||||
$this->_validateUri($uri);
|
||||
|
||||
$this->_actionDictionary->touch();
|
||||
$this->_actionDictionary->URI = new Zend_Pdf_Element_String($uri);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URI to resolve
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->_actionDictionary->URI->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set IsMap property
|
||||
*
|
||||
* If the IsMap flag is true and the user has triggered the URI action by clicking
|
||||
* an annotation, the coordinates of the mouse position at the time the action is
|
||||
* performed should be transformed from device space to user space and then offset
|
||||
* relative to the upper-left corner of the annotation rectangle.
|
||||
*
|
||||
* @param boolean $isMap A flag specifying whether to track the mouse position when the URI is resolved
|
||||
* @return Zend_Pdf_Action_URI
|
||||
*/
|
||||
public function setIsMap($isMap)
|
||||
{
|
||||
$this->_actionDictionary->touch();
|
||||
|
||||
if ($isMap) {
|
||||
$this->_actionDictionary->IsMap = new Zend_Pdf_Element_Boolean(true);
|
||||
} else {
|
||||
$this->_actionDictionary->IsMap = null;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get IsMap property
|
||||
*
|
||||
* If the IsMap flag is true and the user has triggered the URI action by clicking
|
||||
* an annotation, the coordinates of the mouse position at the time the action is
|
||||
* performed should be transformed from device space to user space and then offset
|
||||
* relative to the upper-left corner of the annotation rectangle.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getIsMap()
|
||||
{
|
||||
return $this->_actionDictionary->IsMap !== null &&
|
||||
$this->_actionDictionary->IsMap->value;
|
||||
}
|
||||
}
|
||||
38
modules/ruch/libraries/Zend/Pdf/Action/Unknown.php
Normal file
38
modules/ruch/libraries/Zend/Pdf/Action/Unknown.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Unknown.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
|
||||
/**
|
||||
* Unrecognized PDF action
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
}
|
||||
|
||||
9
modules/ruch/libraries/Zend/Pdf/Action/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Action/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
230
modules/ruch/libraries/Zend/Pdf/Annotation.php
Normal file
230
modules/ruch/libraries/Zend/Pdf/Annotation.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Annotation.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.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-2011 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 annotation’s 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 annotation’s contents
|
||||
* in human-readable form.
|
||||
*
|
||||
* @param string $text
|
||||
* @return Zend_Pdf_Annotation
|
||||
*/
|
||||
public function setText($text) {
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
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 Zend_Pdf_Element $resource
|
||||
* @return Zend_Pdf_Annotation
|
||||
*/
|
||||
public static function load(Zend_Pdf_Element $resource)
|
||||
{
|
||||
/** @todo implementation */
|
||||
}
|
||||
}
|
||||
101
modules/ruch/libraries/Zend/Pdf/Annotation/FileAttachment.php
Normal file
101
modules/ruch/libraries/Zend/Pdf/Annotation/FileAttachment.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FileAttachment.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** 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-2011 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);
|
||||
}
|
||||
}
|
||||
162
modules/ruch/libraries/Zend/Pdf/Annotation/Link.php
Normal file
162
modules/ruch/libraries/Zend/Pdf/Annotation/Link.php
Normal file
@@ -0,0 +1,162 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Link.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Annotation */
|
||||
require_once 'Zend/Pdf/Annotation.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-2011 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) {
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
return Zend_Pdf_Destination::load($this->_annotationDictionary->Dest);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
return Zend_Pdf_Action::load($this->_annotationDictionary->A);
|
||||
}
|
||||
}
|
||||
}
|
||||
142
modules/ruch/libraries/Zend/Pdf/Annotation/Markup.php
Normal file
142
modules/ruch/libraries/Zend/Pdf/Annotation/Markup.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Markup.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Annotation */
|
||||
require_once 'Zend/Pdf/Annotation.php';
|
||||
|
||||
/**
|
||||
* A markup annotation
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Annotation
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Pdf_Annotation_Markup extends Zend_Pdf_Annotation
|
||||
{
|
||||
/**
|
||||
* Annotation subtypes
|
||||
*/
|
||||
const SUBTYPE_HIGHLIGHT = 'Highlight';
|
||||
const SUBTYPE_UNDERLINE = 'Underline';
|
||||
const SUBTYPE_SQUIGGLY = 'Squiggly';
|
||||
const SUBTYPE_STRIKEOUT = 'StrikeOut';
|
||||
|
||||
/**
|
||||
* 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 ||
|
||||
!in_array( $annotationDictionary->Subtype->value,
|
||||
array(self::SUBTYPE_HIGHLIGHT,
|
||||
self::SUBTYPE_UNDERLINE,
|
||||
self::SUBTYPE_SQUIGGLY,
|
||||
self::SUBTYPE_STRIKEOUT) )) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Subtype => Markup entry is omitted or has wrong value.');
|
||||
}
|
||||
|
||||
parent::__construct($annotationDictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create markup annotation object
|
||||
*
|
||||
* Text markup annotations appear as highlights, underlines, strikeouts or
|
||||
* jagged ("squiggly") underlines in the text of a document. When opened,
|
||||
* they display a pop-up window containing the text of the associated note.
|
||||
*
|
||||
* $subType parameter may contain
|
||||
* Zend_Pdf_Annotation_Markup::SUBTYPE_HIGHLIGHT
|
||||
* Zend_Pdf_Annotation_Markup::SUBTYPE_UNDERLINE
|
||||
* Zend_Pdf_Annotation_Markup::SUBTYPE_SQUIGGLY
|
||||
* Zend_Pdf_Annotation_Markup::SUBTYPE_STRIKEOUT
|
||||
* for for a highlight, underline, squiggly-underline, or strikeout annotation,
|
||||
* respectively.
|
||||
*
|
||||
* $quadPoints is an array of 8xN numbers specifying the coordinates of
|
||||
* N quadrilaterals default user space. Each quadrilateral encompasses a word or
|
||||
* group of contiguous words in the text underlying the annotation.
|
||||
* The coordinates for each quadrilateral are given in the order
|
||||
* x1 y1 x2 y2 x3 y3 x4 y4
|
||||
* specifying the quadrilateral’s four vertices in counterclockwise order
|
||||
* starting from left bottom corner.
|
||||
* The text is oriented with respect to the edge connecting points
|
||||
* (x1, y1) and (x2, y2).
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @param string $text
|
||||
* @param string $subType
|
||||
* @param array $quadPoints [x1 y1 x2 y2 x3 y3 x4 y4]
|
||||
* @return Zend_Pdf_Annotation_Markup
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function create($x1, $y1, $x2, $y2, $text, $subType, $quadPoints)
|
||||
{
|
||||
$annotationDictionary = new Zend_Pdf_Element_Dictionary();
|
||||
|
||||
$annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
|
||||
$annotationDictionary->Subtype = new Zend_Pdf_Element_Name($subType);
|
||||
|
||||
$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);
|
||||
|
||||
if (!is_array($quadPoints) || count($quadPoints) == 0 || count($quadPoints) % 8 != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('$quadPoints parameter must be an array of 8xN numbers');
|
||||
}
|
||||
$points = new Zend_Pdf_Element_Array();
|
||||
foreach ($quadPoints as $quadPoint) {
|
||||
$points->items[] = new Zend_Pdf_Element_Numeric($quadPoint);
|
||||
}
|
||||
$annotationDictionary->QuadPoints = $points;
|
||||
|
||||
return new Zend_Pdf_Annotation_Markup($annotationDictionary);
|
||||
}
|
||||
}
|
||||
95
modules/ruch/libraries/Zend/Pdf/Annotation/Text.php
Normal file
95
modules/ruch/libraries/Zend/Pdf/Annotation/Text.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Text.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** 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-2011 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);
|
||||
}
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Annotation/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Annotation/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
182
modules/ruch/libraries/Zend/Pdf/Canvas.php
Normal file
182
modules/ruch/libraries/Zend/Pdf/Canvas.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Style.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
require_once 'Zend/Pdf/Canvas/Abstract.php';
|
||||
|
||||
/**
|
||||
* Canvas is an abstract rectangle drawing area which can be dropped into
|
||||
* page object at specified place.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Pdf_Canvas extends Zend_Pdf_Canvas_Abstract
|
||||
{
|
||||
/**
|
||||
* Canvas procedure sets.
|
||||
*
|
||||
* Allowed values: 'PDF', 'Text', 'ImageB', 'ImageC', 'ImageI'.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_procSet = array();
|
||||
|
||||
/**
|
||||
* Canvas width expressed in default user space units (1/72 inch)
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $_width;
|
||||
|
||||
/**
|
||||
* Canvas height expressed in default user space units (1/72 inch)
|
||||
*
|
||||
* @var float
|
||||
*/
|
||||
protected $_height;
|
||||
|
||||
protected $_resources = array('Font' => array(),
|
||||
'XObject' => array(),
|
||||
'ExtGState' => array());
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param float $width
|
||||
* @param float $height
|
||||
*/
|
||||
public function __construct($width, $height)
|
||||
{
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add procedure set to the canvas description
|
||||
*
|
||||
* @param string $procSetName
|
||||
*/
|
||||
protected function _addProcSet($procSetName)
|
||||
{
|
||||
$this->_procset[$procSetName] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach resource to the canvas
|
||||
*
|
||||
* Method returns a name of the resource which can be used
|
||||
* as a resource reference within drawing instructions stream
|
||||
* Allowed types: 'ExtGState', 'ColorSpace', 'Pattern', 'Shading',
|
||||
* 'XObject', 'Font', 'Properties'
|
||||
*
|
||||
* @param string $type
|
||||
* @param Zend_Pdf_Resource $resource
|
||||
* @return string
|
||||
*/
|
||||
protected function _attachResource($type, Zend_Pdf_Resource $resource)
|
||||
{
|
||||
// Check, that resource is already attached to resource set.
|
||||
$resObject = $resource->getResource();
|
||||
foreach ($this->_resources[$type] as $resName => $collectedResObject) {
|
||||
if ($collectedResObject === $resObject) {
|
||||
return $resName;
|
||||
}
|
||||
}
|
||||
|
||||
$idCounter = 1;
|
||||
do {
|
||||
$newResName = $type[0] . $idCounter++;
|
||||
} while (isset($this->_resources[$type][$newResName]));
|
||||
|
||||
$this->_resources[$type][$newResName] = $resObject;
|
||||
|
||||
return $newResName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns dictionaries of used resources.
|
||||
*
|
||||
* Used for canvas implementations interoperability
|
||||
*
|
||||
* Structure of the returned array:
|
||||
* array(
|
||||
* <resTypeName> => array(
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* ...
|
||||
* ),
|
||||
* <resTypeName> => array(
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* ...
|
||||
* ),
|
||||
* ...
|
||||
* 'ProcSet' => array()
|
||||
* )
|
||||
*
|
||||
* where ProcSet array is a list of used procedure sets names (strings).
|
||||
* Allowed procedure set names: 'PDF', 'Text', 'ImageB', 'ImageC', 'ImageI'
|
||||
*
|
||||
* @internal
|
||||
* @return array
|
||||
*/
|
||||
public function getResources()
|
||||
{
|
||||
$this->_resources['ProcSet'] = array_keys($this->_procSet);
|
||||
return $this->_resources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get drawing instructions stream
|
||||
*
|
||||
* It has to be returned as a PDF stream object to make it reusable.
|
||||
*
|
||||
* @internal
|
||||
* @returns Zend_Pdf_Resource_ContentStream
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
/** @todo implementation */
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the height of this page in points.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the width of this page in points.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
}
|
||||
1214
modules/ruch/libraries/Zend/Pdf/Canvas/Abstract.php
Normal file
1214
modules/ruch/libraries/Zend/Pdf/Canvas/Abstract.php
Normal file
File diff suppressed because it is too large
Load Diff
493
modules/ruch/libraries/Zend/Pdf/Canvas/Interface.php
Normal file
493
modules/ruch/libraries/Zend/Pdf/Canvas/Interface.php
Normal file
@@ -0,0 +1,493 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Style.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Canvas is an abstract rectangle drawing area which can be dropped into
|
||||
* page object at specified place.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Pdf_Canvas_Interface
|
||||
{
|
||||
/**
|
||||
* Returns dictionaries of used resources.
|
||||
*
|
||||
* Used for canvas implementations interoperability
|
||||
*
|
||||
* Structure of the returned array:
|
||||
* array(
|
||||
* <resTypeName> => array(
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* ...
|
||||
* ),
|
||||
* <resTypeName> => array(
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* <resName> => <Zend_Pdf_Resource object>,
|
||||
* ...
|
||||
* ),
|
||||
* ...
|
||||
* 'ProcSet' => array()
|
||||
* )
|
||||
*
|
||||
* where ProcSet array is a list of used procedure sets names (strings).
|
||||
* Allowed procedure set names: 'PDF', 'Text', 'ImageB', 'ImageC', 'ImageI'
|
||||
*
|
||||
* @internal
|
||||
* @return array
|
||||
*/
|
||||
public function getResources();
|
||||
|
||||
/**
|
||||
* Get drawing instructions stream
|
||||
*
|
||||
* It has to be returned as a PDF stream object to make it reusable.
|
||||
*
|
||||
* @internal
|
||||
* @returns Zend_Pdf_Resource_ContentStream
|
||||
*/
|
||||
public function getContents();
|
||||
|
||||
/**
|
||||
* Return canvas height.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getHeight();
|
||||
|
||||
/**
|
||||
* Return canvas width.
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getWidth();
|
||||
|
||||
/**
|
||||
* Draw a canvas at the specified location
|
||||
*
|
||||
* If upper right corner is not specified then canvas heght and width
|
||||
* are used.
|
||||
*
|
||||
* @param Zend_Pdf_Canvas_Interface $canvas
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawCanvas(Zend_Pdf_Canvas_Interface $canvas, $x1, $y1, $x2 = null, $y2 = null);
|
||||
|
||||
/**
|
||||
* Set fill color.
|
||||
*
|
||||
* @param Zend_Pdf_Color $color
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setFillColor(Zend_Pdf_Color $color);
|
||||
|
||||
/**
|
||||
* Set line color.
|
||||
*
|
||||
* @param Zend_Pdf_Color $color
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setLineColor(Zend_Pdf_Color $color);
|
||||
|
||||
/**
|
||||
* Set line width.
|
||||
*
|
||||
* @param float $width
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setLineWidth($width);
|
||||
|
||||
/**
|
||||
* Set line dashing pattern
|
||||
*
|
||||
* Pattern is an array of floats: array(on_length, off_length, on_length, off_length, ...)
|
||||
* or Zend_Pdf_Page::LINE_DASHING_SOLID constant
|
||||
* Phase is shift from the beginning of line.
|
||||
*
|
||||
* @param mixed $pattern
|
||||
* @param array $phase
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setLineDashingPattern($pattern, $phase = 0);
|
||||
|
||||
/**
|
||||
* Set current font.
|
||||
*
|
||||
* @param Zend_Pdf_Resource_Font $font
|
||||
* @param float $fontSize
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setFont(Zend_Pdf_Resource_Font $font, $fontSize);
|
||||
|
||||
/**
|
||||
* Set the style to use for future drawing operations on this page
|
||||
*
|
||||
* @param Zend_Pdf_Style $style
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setStyle(Zend_Pdf_Style $style);
|
||||
|
||||
/**
|
||||
* Get current font.
|
||||
*
|
||||
* @return Zend_Pdf_Resource_Font $font
|
||||
*/
|
||||
public function getFont();
|
||||
|
||||
/**
|
||||
* Get current font size
|
||||
*
|
||||
* @return float $fontSize
|
||||
*/
|
||||
public function getFontSize();
|
||||
|
||||
/**
|
||||
* Return the style, applied to the page.
|
||||
*
|
||||
* @return Zend_Pdf_Style|null
|
||||
*/
|
||||
public function getStyle();
|
||||
|
||||
/**
|
||||
* Save the graphics state of this page.
|
||||
* This takes a snapshot of the currently applied style, position, clipping area and
|
||||
* any rotation/translation/scaling that has been applied.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception - if a save is performed with an open path
|
||||
* @return Zend_Pdf_Page
|
||||
*/
|
||||
public function saveGS();
|
||||
|
||||
/**
|
||||
* Set the transparancy
|
||||
*
|
||||
* $alpha == 0 - transparent
|
||||
* $alpha == 1 - opaque
|
||||
*
|
||||
* Transparency modes, supported by PDF:
|
||||
* Normal (default), Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight,
|
||||
* SoftLight, Difference, Exclusion
|
||||
*
|
||||
* @param float $alpha
|
||||
* @param string $mode
|
||||
* @throws Zend_Pdf_Exception
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function setAlpha($alpha, $mode = 'Normal');
|
||||
|
||||
/**
|
||||
* Intersect current clipping area with a circle.
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $radius
|
||||
* @param float $startAngle
|
||||
* @param float $endAngle
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function clipCircle($x, $y, $radius, $startAngle = null, $endAngle = null);
|
||||
|
||||
/**
|
||||
* Intersect current clipping area with a polygon.
|
||||
*
|
||||
* Method signatures:
|
||||
* drawEllipse($x1, $y1, $x2, $y2);
|
||||
* drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle);
|
||||
*
|
||||
* @todo process special cases with $x2-$x1 == 0 or $y2-$y1 == 0
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @param float $startAngle
|
||||
* @param float $endAngle
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function clipEllipse($x1, $y1, $x2, $y2, $startAngle = null, $endAngle = null);
|
||||
|
||||
/**
|
||||
* Intersect current clipping area with a polygon.
|
||||
*
|
||||
* @param array $x - array of float (the X co-ordinates of the vertices)
|
||||
* @param array $y - array of float (the Y co-ordinates of the vertices)
|
||||
* @param integer $fillMethod
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function clipPolygon($x, $y, $fillMethod = Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING);
|
||||
|
||||
/**
|
||||
* Intersect current clipping area with a rectangle.
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function clipRectangle($x1, $y1, $x2, $y2);
|
||||
|
||||
/**
|
||||
* Draw a circle centered on x, y with a radius of radius.
|
||||
*
|
||||
* Method signatures:
|
||||
* drawCircle($x, $y, $radius);
|
||||
* drawCircle($x, $y, $radius, $fillType);
|
||||
* drawCircle($x, $y, $radius, $startAngle, $endAngle);
|
||||
* drawCircle($x, $y, $radius, $startAngle, $endAngle, $fillType);
|
||||
*
|
||||
*
|
||||
* It's not a really circle, because PDF supports only cubic Bezier curves.
|
||||
* But _very_ good approximation.
|
||||
* It differs from a real circle on a maximum 0.00026 radiuses
|
||||
* (at PI/8, 3*PI/8, 5*PI/8, 7*PI/8, 9*PI/8, 11*PI/8, 13*PI/8 and 15*PI/8 angles).
|
||||
* At 0, PI/4, PI/2, 3*PI/4, PI, 5*PI/4, 3*PI/2 and 7*PI/4 it's exactly a tangent to a circle.
|
||||
*
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $radius
|
||||
* @param mixed $param4
|
||||
* @param mixed $param5
|
||||
* @param mixed $param6
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawCircle($x, $y, $radius, $param4 = null, $param5 = null, $param6 = null);
|
||||
|
||||
/**
|
||||
* Draw an ellipse inside the specified rectangle.
|
||||
*
|
||||
* Method signatures:
|
||||
* drawEllipse($x1, $y1, $x2, $y2);
|
||||
* drawEllipse($x1, $y1, $x2, $y2, $fillType);
|
||||
* drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle);
|
||||
* drawEllipse($x1, $y1, $x2, $y2, $startAngle, $endAngle, $fillType);
|
||||
*
|
||||
* @todo process special cases with $x2-$x1 == 0 or $y2-$y1 == 0
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @param mixed $param5
|
||||
* @param mixed $param6
|
||||
* @param mixed $param7
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawEllipse($x1, $y1, $x2, $y2, $param5 = null, $param6 = null, $param7 = null);
|
||||
|
||||
/**
|
||||
* Draw an image at the specified position on the page.
|
||||
*
|
||||
* @param Zend_Pdf_Image $image
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawImage(Zend_Pdf_Resource_Image $image, $x1, $y1, $x2, $y2);
|
||||
|
||||
/**
|
||||
* Draw a LayoutBox at the specified position on the page.
|
||||
*
|
||||
* @internal (not implemented now)
|
||||
*
|
||||
* @param Zend_Pdf_Element_LayoutBox $box
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawLayoutBox($box, $x, $y);
|
||||
|
||||
/**
|
||||
* Draw a line from x1,y1 to x2,y2.
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawLine($x1, $y1, $x2, $y2);
|
||||
|
||||
/**
|
||||
* Draw a polygon.
|
||||
*
|
||||
* If $fillType is Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE or
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_FILL, then polygon is automatically closed.
|
||||
* See detailed description of these methods in a PDF documentation
|
||||
* (section 4.4.2 Path painting Operators, Filling)
|
||||
*
|
||||
* @param array $x - array of float (the X co-ordinates of the vertices)
|
||||
* @param array $y - array of float (the Y co-ordinates of the vertices)
|
||||
* @param integer $fillType
|
||||
* @param integer $fillMethod
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawPolygon($x, $y,
|
||||
$fillType = Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE,
|
||||
$fillMethod = Zend_Pdf_Page::FILL_METHOD_NON_ZERO_WINDING);
|
||||
/**
|
||||
* Draw a rectangle.
|
||||
*
|
||||
* Fill types:
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE - fill rectangle and stroke (default)
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_STROKE - stroke rectangle
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_FILL - fill rectangle
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @param integer $fillType
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawRectangle($x1, $y1, $x2, $y2, $fillType = Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE);
|
||||
|
||||
/**
|
||||
* Draw a rounded rectangle.
|
||||
*
|
||||
* Fill types:
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE - fill rectangle and stroke (default)
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_STROKE - stroke rectangle
|
||||
* Zend_Pdf_Page::SHAPE_DRAW_FILL - fill rectangle
|
||||
*
|
||||
* radius is an integer representing radius of the four corners, or an array
|
||||
* of four integers representing the radius starting at top left, going
|
||||
* clockwise
|
||||
*
|
||||
* @param float $x1
|
||||
* @param float $y1
|
||||
* @param float $x2
|
||||
* @param float $y2
|
||||
* @param integer|array $radius
|
||||
* @param integer $fillType
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawRoundedRectangle($x1, $y1, $x2, $y2, $radius,
|
||||
$fillType = Zend_Pdf_Page::SHAPE_DRAW_FILL_AND_STROKE);
|
||||
|
||||
/**
|
||||
* Draw a line of text at the specified position.
|
||||
*
|
||||
* @param string $text
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param string $charEncoding (optional) Character encoding of source text.
|
||||
* Defaults to current locale.
|
||||
* @throws Zend_Pdf_Exception
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function drawText($text, $x, $y, $charEncoding = '');
|
||||
|
||||
/**
|
||||
* Close the path by drawing a straight line back to it's beginning.
|
||||
*
|
||||
* @internal (needs implementation)
|
||||
*
|
||||
* @throws Zend_Pdf_Exception - if a path hasn't been started with pathMove()
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function pathClose();
|
||||
|
||||
/**
|
||||
* Continue the open path in a straight line to the specified position.
|
||||
*
|
||||
* @internal (needs implementation)
|
||||
*
|
||||
* @param float $x - the X co-ordinate to move to
|
||||
* @param float $y - the Y co-ordinate to move to
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function pathLine($x, $y);
|
||||
|
||||
/**
|
||||
* Start a new path at the specified position. If a path has already been started,
|
||||
* move the cursor without drawing a line.
|
||||
*
|
||||
* @internal (needs implementation)
|
||||
*
|
||||
* @param float $x - the X co-ordinate to move to
|
||||
* @param float $y - the Y co-ordinate to move to
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function pathMove($x, $y);
|
||||
|
||||
/**
|
||||
* Rotate the page.
|
||||
*
|
||||
* @param float $x - the X co-ordinate of rotation point
|
||||
* @param float $y - the Y co-ordinate of rotation point
|
||||
* @param float $angle - rotation angle
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function rotate($x, $y, $angle);
|
||||
|
||||
/**
|
||||
* Scale coordination system.
|
||||
*
|
||||
* @param float $xScale - X dimention scale factor
|
||||
* @param float $yScale - Y dimention scale factor
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function scale($xScale, $yScale);
|
||||
|
||||
/**
|
||||
* Translate coordination system.
|
||||
*
|
||||
* @param float $xShift - X coordinate shift
|
||||
* @param float $yShift - Y coordinate shift
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function translate($xShift, $yShift);
|
||||
|
||||
/**
|
||||
* Translate coordination system.
|
||||
*
|
||||
* @param float $x - the X co-ordinate of axis skew point
|
||||
* @param float $y - the Y co-ordinate of axis skew point
|
||||
* @param float $xAngle - X axis skew angle
|
||||
* @param float $yAngle - Y axis skew angle
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function skew($x, $y, $xAngle, $yAngle);
|
||||
|
||||
/**
|
||||
* Writes the raw data to the page's content stream.
|
||||
*
|
||||
* Be sure to consult the PDF reference to ensure your syntax is correct. No
|
||||
* attempt is made to ensure the validity of the stream data.
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $procSet (optional) Name of ProcSet to add.
|
||||
* @return Zend_Pdf_Canvas_Interface
|
||||
*/
|
||||
public function rawWrite($data, $procSet = null);
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Canvas/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Canvas/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
336
modules/ruch/libraries/Zend/Pdf/Cmap.php
Normal file
336
modules/ruch/libraries/Zend/Pdf/Cmap.php
Normal file
@@ -0,0 +1,336 @@
|
||||
<?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 Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Cmap.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Abstract helper class for {@link Zend_Pdf_Resource_Font} which manages font
|
||||
* character maps.
|
||||
*
|
||||
* Defines the public interface for concrete subclasses which are responsible
|
||||
* for mapping Unicode characters to the font's glyph numbers. Also provides
|
||||
* shared utility methods.
|
||||
*
|
||||
* Cmap objects should ordinarily be obtained through the factory method
|
||||
* {@link cmapWithTypeData()}.
|
||||
*
|
||||
* The supported character map types are those found in the OpenType spec. For
|
||||
* additional detail on the internal binary format of these tables, see:
|
||||
* <ul>
|
||||
* <li>{@link http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6cmap.html}
|
||||
* <li>{@link http://www.microsoft.com/OpenType/OTSpec/cmap.htm}
|
||||
* <li>{@link http://partners.adobe.com/public/developer/opentype/index_cmap.html}
|
||||
* </ul>
|
||||
*
|
||||
* @todo Write code for Zend_Pdf_FontCmap_HighByteMapping class.
|
||||
* @todo Write code for Zend_Pdf_FontCmap_MixedCoverage class.
|
||||
* @todo Write code for Zend_Pdf_FontCmap_TrimmedArray class.
|
||||
* @todo Write code for Zend_Pdf_FontCmap_SegmentedCoverage class.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Pdf_Cmap
|
||||
{
|
||||
/**** Class Constants ****/
|
||||
|
||||
|
||||
/* Cmap Table Types */
|
||||
|
||||
/**
|
||||
* Byte Encoding character map table type.
|
||||
*/
|
||||
const TYPE_BYTE_ENCODING = 0x00;
|
||||
|
||||
/**
|
||||
* High Byte Mapping character map table type.
|
||||
*/
|
||||
const TYPE_HIGH_BYTE_MAPPING = 0x02;
|
||||
|
||||
/**
|
||||
* Segment Value to Delta Mapping character map table type.
|
||||
*/
|
||||
const TYPE_SEGMENT_TO_DELTA = 0x04;
|
||||
|
||||
/**
|
||||
* Trimmed Table character map table type.
|
||||
*/
|
||||
const TYPE_TRIMMED_TABLE = 0x06;
|
||||
|
||||
/**
|
||||
* Mixed Coverage character map table type.
|
||||
*/
|
||||
const TYPE_MIXED_COVERAGE = 0x08;
|
||||
|
||||
/**
|
||||
* Trimmed Array character map table type.
|
||||
*/
|
||||
const TYPE_TRIMMED_ARRAY = 0x0a;
|
||||
|
||||
/**
|
||||
* Segmented Coverage character map table type.
|
||||
*/
|
||||
const TYPE_SEGMENTED_COVERAGE = 0x0c;
|
||||
|
||||
/**
|
||||
* Static Byte Encoding character map table type. Variant of
|
||||
* {@link TYPE_BYTEENCODING}.
|
||||
*/
|
||||
const TYPE_BYTE_ENCODING_STATIC = 0xf1;
|
||||
|
||||
/**
|
||||
* Unknown character map table type.
|
||||
*/
|
||||
const TYPE_UNKNOWN = 0xff;
|
||||
|
||||
|
||||
/* Special Glyph Names */
|
||||
|
||||
/**
|
||||
* Glyph representing missing characters.
|
||||
*/
|
||||
const MISSING_CHARACTER_GLYPH = 0x00;
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Factory Methods */
|
||||
|
||||
/**
|
||||
* Instantiates the appropriate concrete subclass based on the type of cmap
|
||||
* table and returns the instance.
|
||||
*
|
||||
* The cmap type must be one of the following values:
|
||||
* <ul>
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_BYTE_ENCODING}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_HIGH_BYTE_MAPPING}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_SEGMENT_TO_DELTA}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_TRIMMED_TABLE}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_MIXED_COVERAGE}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_TRIMMED_ARRAY}
|
||||
* <li>{@link Zend_Pdf_Cmap::TYPE_SEGMENTED_COVERAGE}
|
||||
* </ul>
|
||||
*
|
||||
* Throws an exception if the table type is invalid or the cmap table data
|
||||
* cannot be validated.
|
||||
*
|
||||
* @param integer $cmapType Type of cmap.
|
||||
* @param mixed $cmapData Cmap table data. Usually a string or array.
|
||||
* @return Zend_Pdf_Cmap
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function cmapWithTypeData($cmapType, $cmapData)
|
||||
{
|
||||
switch ($cmapType) {
|
||||
case Zend_Pdf_Cmap::TYPE_BYTE_ENCODING:
|
||||
require_once 'Zend/Pdf/Cmap/ByteEncoding.php';
|
||||
return new Zend_Pdf_Cmap_ByteEncoding($cmapData);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC:
|
||||
require_once 'Zend/Pdf/Cmap/ByteEncoding/Static.php';
|
||||
return new Zend_Pdf_Cmap_ByteEncoding_Static($cmapData);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_HIGH_BYTE_MAPPING:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('High byte mapping cmap currently unsupported',
|
||||
Zend_Pdf_Exception::CMAP_TYPE_UNSUPPORTED);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_SEGMENT_TO_DELTA:
|
||||
require_once 'Zend/Pdf/Cmap/SegmentToDelta.php';
|
||||
return new Zend_Pdf_Cmap_SegmentToDelta($cmapData);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_TRIMMED_TABLE:
|
||||
require_once 'Zend/Pdf/Cmap/TrimmedTable.php';
|
||||
return new Zend_Pdf_Cmap_TrimmedTable($cmapData);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_MIXED_COVERAGE:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Mixed coverage cmap currently unsupported',
|
||||
Zend_Pdf_Exception::CMAP_TYPE_UNSUPPORTED);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_TRIMMED_ARRAY:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Trimmed array cmap currently unsupported',
|
||||
Zend_Pdf_Exception::CMAP_TYPE_UNSUPPORTED);
|
||||
|
||||
case Zend_Pdf_Cmap::TYPE_SEGMENTED_COVERAGE:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Segmented coverage cmap currently unsupported',
|
||||
Zend_Pdf_Exception::CMAP_TYPE_UNSUPPORTED);
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unknown cmap type: $cmapType",
|
||||
Zend_Pdf_Exception::CMAP_UNKNOWN_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Abstract Methods */
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* Parses the raw binary table data. Throws an exception if the table is
|
||||
* malformed.
|
||||
*
|
||||
* @param string $cmapData Raw binary cmap table data.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
abstract public function __construct($cmapData);
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumberForCharacter()}.
|
||||
*
|
||||
* @param array $characterCodes Array of Unicode character codes (code points).
|
||||
* @return array Array of glyph numbers.
|
||||
*/
|
||||
abstract public function glyphNumbersForCharacters($characterCodes);
|
||||
|
||||
/**
|
||||
* Returns the glyph number corresponding to the Unicode character.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumbersForCharacters()} which is optimized for bulk
|
||||
* operations.
|
||||
*
|
||||
* @param integer $characterCode Unicode character code (code point).
|
||||
* @return integer Glyph number.
|
||||
*/
|
||||
abstract public function glyphNumberForCharacter($characterCode);
|
||||
|
||||
/**
|
||||
* Returns an array containing the Unicode characters that have entries in
|
||||
* this character map.
|
||||
*
|
||||
* @return array Unicode character codes.
|
||||
*/
|
||||
abstract public function getCoveredCharacters();
|
||||
|
||||
/**
|
||||
* Returns an array containing the glyphs numbers that have entries in this character map.
|
||||
* Keys are Unicode character codes (integers)
|
||||
*
|
||||
* This functionality is partially covered by glyphNumbersForCharacters(getCoveredCharacters())
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
* @return array Array representing <Unicode character code> => <glyph number> pairs.
|
||||
*/
|
||||
abstract public function getCoveredCharactersGlyphs();
|
||||
|
||||
|
||||
/**** Internal Methods ****/
|
||||
|
||||
|
||||
/* Internal Utility Methods */
|
||||
|
||||
/**
|
||||
* Extracts a signed 2-byte integer from a string.
|
||||
*
|
||||
* Integers are always big-endian. Throws an exception if the index is out
|
||||
* of range.
|
||||
*
|
||||
* @param string &$data
|
||||
* @param integer $index Position in string of integer.
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected function _extractInt2(&$data, $index)
|
||||
{
|
||||
if (($index < 0) | (($index + 1) > strlen($data))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Index out of range: $index",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
$number = ord($data[$index]);
|
||||
if (($number & 0x80) == 0x80) { // negative
|
||||
$number = ~((((~ $number) & 0xff) << 8) | ((~ ord($data[++$index])) & 0xff));
|
||||
} else {
|
||||
$number = ($number << 8) | ord($data[++$index]);
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts an unsigned 2-byte integer from a string.
|
||||
*
|
||||
* Integers are always big-endian. Throws an exception if the index is out
|
||||
* of range.
|
||||
*
|
||||
* @param string &$data
|
||||
* @param integer $index Position in string of integer.
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected function _extractUInt2(&$data, $index)
|
||||
{
|
||||
if (($index < 0) | (($index + 1) > strlen($data))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Index out of range: $index",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
$number = (ord($data[$index]) << 8) | ord($data[++$index]);
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts an unsigned 4-byte integer from a string.
|
||||
*
|
||||
* Integers are always big-endian. Throws an exception if the index is out
|
||||
* of range.
|
||||
*
|
||||
* NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the
|
||||
* resulting value WILL BE SIGNED because PHP uses signed integers internally
|
||||
* for everything. To guarantee portability, be sure to use bitwise or
|
||||
* similar operators on large integers!
|
||||
*
|
||||
* @param string &$data
|
||||
* @param integer $index Position in string of integer.
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected function _extractUInt4(&$data, $index)
|
||||
{
|
||||
if (($index < 0) | (($index + 3) > strlen($data))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Index out of range: $index",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
$number = (ord($data[$index]) << 24) | (ord($data[++$index]) << 16) |
|
||||
(ord($data[++$index]) << 8) | ord($data[++$index]);
|
||||
return $number;
|
||||
}
|
||||
|
||||
}
|
||||
447
modules/ruch/libraries/Zend/Pdf/Cmap/ByteEncoding.php
Normal file
447
modules/ruch/libraries/Zend/Pdf/Cmap/ByteEncoding.php
Normal file
@@ -0,0 +1,447 @@
|
||||
<?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 Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ByteEncoding.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implements the "byte encoding" character map (type 0).
|
||||
*
|
||||
* This is the (legacy) Apple standard encoding mechanism and provides coverage
|
||||
* for characters in the Mac Roman character set only. Consequently, this cmap
|
||||
* type should be used only as a last resort.
|
||||
*
|
||||
* The mapping from Mac Roman to Unicode can be found at
|
||||
* {@link http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT}.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* Glyph index array. Stores the actual glyph numbers. The array keys are
|
||||
* the translated Unicode code points.
|
||||
* @var array
|
||||
*/
|
||||
protected $_glyphIndexArray = array();
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumberForCharacter()}.
|
||||
*
|
||||
* @param array $characterCodes Array of Unicode character codes (code points).
|
||||
* @return array Array of glyph numbers.
|
||||
*/
|
||||
public function glyphNumbersForCharacters($characterCodes)
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
foreach ($characterCodes as $key => $characterCode) {
|
||||
|
||||
if (! isset($this->_glyphIndexArray[$characterCode])) {
|
||||
$glyphNumbers[$key] = Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
continue;
|
||||
}
|
||||
|
||||
$glyphNumbers[$key] = $this->_glyphIndexArray[$characterCode];
|
||||
|
||||
}
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the glyph number corresponding to the Unicode character.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumbersForCharacters()} which is optimized for bulk
|
||||
* operations.
|
||||
*
|
||||
* @param integer $characterCode Unicode character code (code point).
|
||||
* @return integer Glyph number.
|
||||
*/
|
||||
public function glyphNumberForCharacter($characterCode)
|
||||
{
|
||||
if (! isset($this->_glyphIndexArray[$characterCode])) {
|
||||
return Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
}
|
||||
return $this->_glyphIndexArray[$characterCode];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing the Unicode characters that have entries in
|
||||
* this character map.
|
||||
*
|
||||
* @return array Unicode character codes.
|
||||
*/
|
||||
public function getCoveredCharacters()
|
||||
{
|
||||
return array_keys($this->_glyphIndexArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing the glyphs numbers that have entries in this character map.
|
||||
* Keys are Unicode character codes (integers)
|
||||
*
|
||||
* This functionality is partially covered by glyphNumbersForCharacters(getCoveredCharacters())
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
* @return array Array representing <Unicode character code> => <glyph number> pairs.
|
||||
*/
|
||||
public function getCoveredCharactersGlyphs()
|
||||
{
|
||||
return $this->_glyphIndexArray;
|
||||
}
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* Parses the raw binary table data. Throws an exception if the table is
|
||||
* malformed.
|
||||
*
|
||||
* @param string $cmapData Raw binary cmap table data.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($cmapData)
|
||||
{
|
||||
/* Sanity check: This table must be exactly 262 bytes long.
|
||||
*/
|
||||
$actualLength = strlen($cmapData);
|
||||
if ($actualLength != 262) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Insufficient table data',
|
||||
Zend_Pdf_Exception::CMAP_TABLE_DATA_TOO_SMALL);
|
||||
}
|
||||
|
||||
/* Sanity check: Make sure this is right data for this table type.
|
||||
*/
|
||||
$type = $this->_extractUInt2($cmapData, 0);
|
||||
if ($type != Zend_Pdf_Cmap::TYPE_BYTE_ENCODING) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong cmap table type',
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_TYPE);
|
||||
}
|
||||
|
||||
$length = $this->_extractUInt2($cmapData, 2);
|
||||
if ($length != $actualLength) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table length ($length) does not match actual length ($actualLength)",
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_LENGTH);
|
||||
}
|
||||
|
||||
/* Mapping tables should be language-independent. The font may not work
|
||||
* as expected if they are not. Unfortunately, many font files in the
|
||||
* wild incorrectly record a language ID in this field, so we can't
|
||||
* call this a failure.
|
||||
*/
|
||||
$language = $this->_extractUInt2($cmapData, 4);
|
||||
if ($language != 0) {
|
||||
// Record a warning here somehow?
|
||||
}
|
||||
|
||||
/* The mapping between the Mac Roman and Unicode characters is static.
|
||||
* For simplicity, just put all 256 glyph indices into one array keyed
|
||||
* off the corresponding Unicode character.
|
||||
*/
|
||||
$i = 6;
|
||||
$this->_glyphIndexArray[0x00] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x01] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x03] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x04] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x05] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x06] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x07] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x08] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x09] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x10] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x11] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x12] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x13] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x14] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x15] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x16] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x17] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x18] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x19] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x1f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x20] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x21] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x22] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x23] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x24] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x25] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x26] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x27] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x28] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x29] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x30] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x31] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x32] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x33] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x34] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x35] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x36] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x37] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x38] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x39] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x3f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x40] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x41] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x42] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x43] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x44] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x45] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x46] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x47] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x48] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x49] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x4f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x50] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x51] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x52] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x53] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x54] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x55] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x56] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x57] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x58] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x59] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x5f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x60] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x61] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x62] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x63] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x64] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x65] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x66] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x67] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x68] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x69] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x6f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x70] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x71] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x72] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x73] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x74] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x75] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x76] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x77] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x78] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x79] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x7f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc4] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc7] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xdc] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe0] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe2] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe4] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe3] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe7] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xea] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xeb] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xed] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xec] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xee] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xef] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf3] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf2] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf4] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xfa] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xfb] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xfc] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2020] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb0] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa2] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa3] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa7] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2022] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xdf] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xae] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2122] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb4] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2260] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x221e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2264] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2265] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2202] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2211] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x220f] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x03c0] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x222b] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xaa] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xba] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x03a9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xe6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xbf] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xac] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x221a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0192] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2248] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2206] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xab] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xbb] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2026] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xa0] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc0] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc3] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd5] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0152] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0153] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2013] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2014] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x201c] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x201d] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2018] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2019] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf7] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x25ca] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xff] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0178] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2044] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x20ac] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2039] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x203a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xfb01] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xfb02] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2021] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb7] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x201a] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x201e] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x2030] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc2] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xca] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc1] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xcb] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xc8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xcd] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xce] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xcf] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xcc] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd3] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd4] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xf8ff] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd2] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xda] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xdb] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xd9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x0131] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02c6] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02dc] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xaf] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02d8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02d9] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02da] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0xb8] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02dd] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02db] = ord($cmapData[$i++]);
|
||||
$this->_glyphIndexArray[0x02c7] = ord($cmapData[$i]);
|
||||
}
|
||||
|
||||
}
|
||||
62
modules/ruch/libraries/Zend/Pdf/Cmap/ByteEncoding/Static.php
Normal file
62
modules/ruch/libraries/Zend/Pdf/Cmap/ByteEncoding/Static.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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 Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Static.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap_ByteEncoding */
|
||||
require_once 'Zend/Pdf/Cmap/ByteEncoding.php';
|
||||
|
||||
|
||||
/**
|
||||
* Custom cmap type used for the Adobe Standard 14 PDF fonts.
|
||||
*
|
||||
* Just like {@link Zend_Pdf_Cmap_ByteEncoding} except that the constructor
|
||||
* takes a predefined array of glyph numbers and can cover any Unicode character.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param array $cmapData Array whose keys are Unicode character codes and
|
||||
* values are glyph numbers.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($cmapData)
|
||||
{
|
||||
if (! is_array($cmapData)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Constructor parameter must be an array',
|
||||
Zend_Pdf_Exception::BAD_PARAMETER_TYPE);
|
||||
}
|
||||
$this->_glyphIndexArray = $cmapData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
407
modules/ruch/libraries/Zend/Pdf/Cmap/SegmentToDelta.php
Normal file
407
modules/ruch/libraries/Zend/Pdf/Cmap/SegmentToDelta.php
Normal file
@@ -0,0 +1,407 @@
|
||||
<?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 Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SegmentToDelta.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implements the "segment mapping to delta values" character map (type 4).
|
||||
*
|
||||
* This is the Microsoft standard mapping table type for OpenType fonts. It
|
||||
* provides the ability to cover multiple contiguous ranges of the Unicode
|
||||
* character set, with the exception of Unicode Surrogates (U+D800 - U+DFFF).
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* The number of segments in the table.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_segmentCount = 0;
|
||||
|
||||
/**
|
||||
* The size of the binary search range for segments.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_searchRange = 0;
|
||||
|
||||
/**
|
||||
* The number of binary search steps required to cover the entire search
|
||||
* range.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_searchIterations = 0;
|
||||
|
||||
/**
|
||||
* Array of ending character codes for each segment.
|
||||
* @var array
|
||||
*/
|
||||
protected $_segmentTableEndCodes = array();
|
||||
|
||||
/**
|
||||
* The ending character code for the segment at the end of the low search
|
||||
* range.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_searchRangeEndCode = 0;
|
||||
|
||||
/**
|
||||
* Array of starting character codes for each segment.
|
||||
* @var array
|
||||
*/
|
||||
protected $_segmentTableStartCodes = array();
|
||||
|
||||
/**
|
||||
* Array of character code to glyph delta values for each segment.
|
||||
* @var array
|
||||
*/
|
||||
protected $_segmentTableIdDeltas = array();
|
||||
|
||||
/**
|
||||
* Array of offsets into the glyph index array for each segment.
|
||||
* @var array
|
||||
*/
|
||||
protected $_segmentTableIdRangeOffsets = array();
|
||||
|
||||
/**
|
||||
* Glyph index array. Stores glyph numbers, used with range offset.
|
||||
* @var array
|
||||
*/
|
||||
protected $_glyphIndexArray = array();
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumberForCharacter()}.
|
||||
*
|
||||
* @param array $characterCodes Array of Unicode character codes (code points).
|
||||
* @return array Array of glyph numbers.
|
||||
*/
|
||||
public function glyphNumbersForCharacters($characterCodes)
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
foreach ($characterCodes as $key => $characterCode) {
|
||||
|
||||
/* These tables only cover the 16-bit character range.
|
||||
*/
|
||||
if ($characterCode > 0xffff) {
|
||||
$glyphNumbers[$key] = Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Determine where to start the binary search. The segments are
|
||||
* ordered from lowest-to-highest. We are looking for the first
|
||||
* segment whose end code is greater than or equal to our character
|
||||
* code.
|
||||
*
|
||||
* If the end code at the top of the search range is larger, then
|
||||
* our target is probably below it.
|
||||
*
|
||||
* If it is smaller, our target is probably above it, so move the
|
||||
* search range to the end of the segment list.
|
||||
*/
|
||||
if ($this->_searchRangeEndCode >= $characterCode) {
|
||||
$searchIndex = $this->_searchRange;
|
||||
} else {
|
||||
$searchIndex = $this->_segmentCount;
|
||||
}
|
||||
|
||||
/* Now do a binary search to find the first segment whose end code
|
||||
* is greater or equal to our character code. No matter the number
|
||||
* of segments (there may be hundreds in a large font), we will only
|
||||
* need to perform $this->_searchIterations.
|
||||
*/
|
||||
for ($i = 1; $i <= $this->_searchIterations; $i++) {
|
||||
if ($this->_segmentTableEndCodes[$searchIndex] >= $characterCode) {
|
||||
$subtableIndex = $searchIndex;
|
||||
$searchIndex -= $this->_searchRange >> $i;
|
||||
} else {
|
||||
$searchIndex += $this->_searchRange >> $i;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the segment's start code is greater than our character code,
|
||||
* that character is not represented in this font. Move on.
|
||||
*/
|
||||
if ($this->_segmentTableStartCodes[$subtableIndex] > $characterCode) {
|
||||
$glyphNumbers[$key] = Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->_segmentTableIdRangeOffsets[$subtableIndex] == 0) {
|
||||
/* This segment uses a simple mapping from character code to
|
||||
* glyph number.
|
||||
*/
|
||||
$glyphNumbers[$key] = ($characterCode + $this->_segmentTableIdDeltas[$subtableIndex]) % 65536;
|
||||
|
||||
} else {
|
||||
/* This segment relies on the glyph index array to determine the
|
||||
* glyph number. The calculation below determines the correct
|
||||
* index into that array. It's a little odd because the range
|
||||
* offset in the font file is designed to quickly provide an
|
||||
* address of the index in the raw binary data instead of the
|
||||
* index itself. Since we've parsed the data into arrays, we
|
||||
* must process it a bit differently.
|
||||
*/
|
||||
$glyphIndex = ($characterCode - $this->_segmentTableStartCodes[$subtableIndex] +
|
||||
$this->_segmentTableIdRangeOffsets[$subtableIndex] - $this->_segmentCount +
|
||||
$subtableIndex - 1);
|
||||
$glyphNumbers[$key] = $this->_glyphIndexArray[$glyphIndex];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the glyph number corresponding to the Unicode character.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumbersForCharacters()} which is optimized for bulk
|
||||
* operations.
|
||||
*
|
||||
* @param integer $characterCode Unicode character code (code point).
|
||||
* @return integer Glyph number.
|
||||
*/
|
||||
public function glyphNumberForCharacter($characterCode)
|
||||
{
|
||||
/* This code is pretty much a copy of glyphNumbersForCharacters().
|
||||
* See that method for inline documentation.
|
||||
*/
|
||||
|
||||
if ($characterCode > 0xffff) {
|
||||
return Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
}
|
||||
|
||||
if ($this->_searchRangeEndCode >= $characterCode) {
|
||||
$searchIndex = $this->_searchRange;
|
||||
} else {
|
||||
$searchIndex = $this->_segmentCount;
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= $this->_searchIterations; $i++) {
|
||||
if ($this->_segmentTableEndCodes[$searchIndex] >= $characterCode) {
|
||||
$subtableIndex = $searchIndex;
|
||||
$searchIndex -= $this->_searchRange >> $i;
|
||||
} else {
|
||||
$searchIndex += $this->_searchRange >> $i;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_segmentTableStartCodes[$subtableIndex] > $characterCode) {
|
||||
return Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
}
|
||||
|
||||
if ($this->_segmentTableIdRangeOffsets[$subtableIndex] == 0) {
|
||||
$glyphNumber = ($characterCode + $this->_segmentTableIdDeltas[$subtableIndex]) % 65536;
|
||||
} else {
|
||||
$glyphIndex = ($characterCode - $this->_segmentTableStartCodes[$subtableIndex] +
|
||||
$this->_segmentTableIdRangeOffsets[$subtableIndex] - $this->_segmentCount +
|
||||
$subtableIndex - 1);
|
||||
$glyphNumber = $this->_glyphIndexArray[$glyphIndex];
|
||||
}
|
||||
return $glyphNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing the Unicode characters that have entries in
|
||||
* this character map.
|
||||
*
|
||||
* @return array Unicode character codes.
|
||||
*/
|
||||
public function getCoveredCharacters()
|
||||
{
|
||||
$characterCodes = array();
|
||||
for ($i = 1; $i <= $this->_segmentCount; $i++) {
|
||||
for ($code = $this->_segmentTableStartCodes[$i]; $code <= $this->_segmentTableEndCodes[$i]; $code++) {
|
||||
$characterCodes[] = $code;
|
||||
}
|
||||
}
|
||||
return $characterCodes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array containing the glyphs numbers that have entries in this character map.
|
||||
* Keys are Unicode character codes (integers)
|
||||
*
|
||||
* This functionality is partially covered by glyphNumbersForCharacters(getCoveredCharacters())
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
* @return array Array representing <Unicode character code> => <glyph number> pairs.
|
||||
*/
|
||||
public function getCoveredCharactersGlyphs()
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
|
||||
for ($segmentNum = 1; $segmentNum <= $this->_segmentCount; $segmentNum++) {
|
||||
if ($this->_segmentTableIdRangeOffsets[$segmentNum] == 0) {
|
||||
$delta = $this->_segmentTableIdDeltas[$segmentNum];
|
||||
|
||||
for ($code = $this->_segmentTableStartCodes[$segmentNum];
|
||||
$code <= $this->_segmentTableEndCodes[$segmentNum];
|
||||
$code++) {
|
||||
$glyphNumbers[$code] = ($code + $delta) % 65536;
|
||||
}
|
||||
} else {
|
||||
$code = $this->_segmentTableStartCodes[$segmentNum];
|
||||
$glyphIndex = $this->_segmentTableIdRangeOffsets[$segmentNum] - ($this->_segmentCount - $segmentNum) - 1;
|
||||
|
||||
while ($code <= $this->_segmentTableEndCodes[$segmentNum]) {
|
||||
$glyphNumbers[$code] = $this->_glyphIndexArray[$glyphIndex];
|
||||
|
||||
$code++;
|
||||
$glyphIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* Parses the raw binary table data. Throws an exception if the table is
|
||||
* malformed.
|
||||
*
|
||||
* @param string $cmapData Raw binary cmap table data.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($cmapData)
|
||||
{
|
||||
/* Sanity check: The table should be at least 23 bytes in size.
|
||||
*/
|
||||
$actualLength = strlen($cmapData);
|
||||
if ($actualLength < 23) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Insufficient table data',
|
||||
Zend_Pdf_Exception::CMAP_TABLE_DATA_TOO_SMALL);
|
||||
}
|
||||
|
||||
/* Sanity check: Make sure this is right data for this table type.
|
||||
*/
|
||||
$type = $this->_extractUInt2($cmapData, 0);
|
||||
if ($type != Zend_Pdf_Cmap::TYPE_SEGMENT_TO_DELTA) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong cmap table type',
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_TYPE);
|
||||
}
|
||||
|
||||
$length = $this->_extractUInt2($cmapData, 2);
|
||||
if ($length != $actualLength) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table length ($length) does not match actual length ($actualLength)",
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_LENGTH);
|
||||
}
|
||||
|
||||
/* Mapping tables should be language-independent. The font may not work
|
||||
* as expected if they are not. Unfortunately, many font files in the
|
||||
* wild incorrectly record a language ID in this field, so we can't
|
||||
* call this a failure.
|
||||
*/
|
||||
$language = $this->_extractUInt2($cmapData, 4);
|
||||
if ($language != 0) {
|
||||
// Record a warning here somehow?
|
||||
}
|
||||
|
||||
/* These two values are stored premultiplied by two which is convienent
|
||||
* when using the binary data directly, but we're parsing it out to
|
||||
* native PHP data types, so divide by two.
|
||||
*/
|
||||
$this->_segmentCount = $this->_extractUInt2($cmapData, 6) >> 1;
|
||||
$this->_searchRange = $this->_extractUInt2($cmapData, 8) >> 1;
|
||||
|
||||
$this->_searchIterations = $this->_extractUInt2($cmapData, 10) + 1;
|
||||
|
||||
$offset = 14;
|
||||
for ($i = 1; $i <= $this->_segmentCount; $i++, $offset += 2) {
|
||||
$this->_segmentTableEndCodes[$i] = $this->_extractUInt2($cmapData, $offset);
|
||||
}
|
||||
|
||||
$this->_searchRangeEndCode = $this->_segmentTableEndCodes[$this->_searchRange];
|
||||
|
||||
$offset += 2; // reserved bytes
|
||||
|
||||
for ($i = 1; $i <= $this->_segmentCount; $i++, $offset += 2) {
|
||||
$this->_segmentTableStartCodes[$i] = $this->_extractUInt2($cmapData, $offset);
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= $this->_segmentCount; $i++, $offset += 2) {
|
||||
$this->_segmentTableIdDeltas[$i] = $this->_extractInt2($cmapData, $offset); // signed
|
||||
}
|
||||
|
||||
/* The range offset helps determine the index into the glyph index array.
|
||||
* Like the segment count and search range above, it's stored as a byte
|
||||
* multiple in the font, so divide by two as we extract the values.
|
||||
*/
|
||||
for ($i = 1; $i <= $this->_segmentCount; $i++, $offset += 2) {
|
||||
$this->_segmentTableIdRangeOffsets[$i] = $this->_extractUInt2($cmapData, $offset) >> 1;
|
||||
}
|
||||
|
||||
/* The size of the glyph index array varies by font and depends on the
|
||||
* extent of the usage of range offsets versus deltas. Some fonts may
|
||||
* not have any entries in this array.
|
||||
*/
|
||||
for (; $offset < $length; $offset += 2) {
|
||||
$this->_glyphIndexArray[] = $this->_extractUInt2($cmapData, $offset);
|
||||
}
|
||||
|
||||
/* Sanity check: After reading all of the data, we should be at the end
|
||||
* of the table.
|
||||
*/
|
||||
if ($offset != $length) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Ending offset ($offset) does not match length ($length)",
|
||||
Zend_Pdf_Exception::CMAP_FINAL_OFFSET_NOT_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
231
modules/ruch/libraries/Zend/Pdf/Cmap/TrimmedTable.php
Normal file
231
modules/ruch/libraries/Zend/Pdf/Cmap/TrimmedTable.php
Normal file
@@ -0,0 +1,231 @@
|
||||
<?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 Fonts
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrimmedTable.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implements the "trimmed table mapping" character map (type 6).
|
||||
*
|
||||
* This table type is preferred over the {@link Zend_Pdf_Cmap_SegmentToDelta}
|
||||
* table when the Unicode characters covered by the font fall into a single
|
||||
* contiguous range.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* The starting character code covered by this table.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_startCode = 0;
|
||||
|
||||
/**
|
||||
* The ending character code covered by this table.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_endCode = 0;
|
||||
|
||||
/**
|
||||
* Glyph index array. Stores the actual glyph numbers.
|
||||
* @var array
|
||||
*/
|
||||
protected $_glyphIndexArray = array();
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumberForCharacter()}.
|
||||
*
|
||||
* @param array $characterCodes Array of Unicode character codes (code points).
|
||||
* @return array Array of glyph numbers.
|
||||
*/
|
||||
public function glyphNumbersForCharacters($characterCodes)
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
foreach ($characterCodes as $key => $characterCode) {
|
||||
|
||||
if (($characterCode < $this->_startCode) || ($characterCode > $this->_endCode)) {
|
||||
$glyphNumbers[$key] = Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
continue;
|
||||
}
|
||||
|
||||
$glyphIndex = $characterCode - $this->_startCode;
|
||||
$glyphNumbers[$key] = $this->_glyphIndexArray[$glyphIndex];
|
||||
|
||||
}
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the glyph number corresponding to the Unicode character.
|
||||
*
|
||||
* If a particular character doesn't exist in this font, the special 'missing
|
||||
* character glyph' will be substituted.
|
||||
*
|
||||
* See also {@link glyphNumbersForCharacters()} which is optimized for bulk
|
||||
* operations.
|
||||
*
|
||||
* @param integer $characterCode Unicode character code (code point).
|
||||
* @return integer Glyph number.
|
||||
*/
|
||||
public function glyphNumberForCharacter($characterCode)
|
||||
{
|
||||
if (($characterCode < $this->_startCode) || ($characterCode > $this->_endCode)) {
|
||||
return Zend_Pdf_Cmap::MISSING_CHARACTER_GLYPH;
|
||||
}
|
||||
$glyphIndex = $characterCode - $this->_startCode;
|
||||
return $this->_glyphIndexArray[$glyphIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array containing the Unicode characters that have entries in
|
||||
* this character map.
|
||||
*
|
||||
* @return array Unicode character codes.
|
||||
*/
|
||||
public function getCoveredCharacters()
|
||||
{
|
||||
$characterCodes = array();
|
||||
for ($code = $this->_startCode; $code <= $this->_endCode; $code++) {
|
||||
$characterCodes[] = $code;
|
||||
}
|
||||
return $characterCodes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array containing the glyphs numbers that have entries in this character map.
|
||||
* Keys are Unicode character codes (integers)
|
||||
*
|
||||
* This functionality is partially covered by glyphNumbersForCharacters(getCoveredCharacters())
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
* @return array Array representing <Unicode character code> => <glyph number> pairs.
|
||||
*/
|
||||
public function getCoveredCharactersGlyphs()
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
for ($code = $this->_startCode; $code <= $this->_endCode; $code++) {
|
||||
$glyphNumbers[$code] = $this->_glyphIndexArray[$code - $this->_startCode];
|
||||
}
|
||||
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* Parses the raw binary table data. Throws an exception if the table is
|
||||
* malformed.
|
||||
*
|
||||
* @param string $cmapData Raw binary cmap table data.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($cmapData)
|
||||
{
|
||||
/* Sanity check: The table should be at least 9 bytes in size.
|
||||
*/
|
||||
$actualLength = strlen($cmapData);
|
||||
if ($actualLength < 9) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Insufficient table data',
|
||||
Zend_Pdf_Exception::CMAP_TABLE_DATA_TOO_SMALL);
|
||||
}
|
||||
|
||||
/* Sanity check: Make sure this is right data for this table type.
|
||||
*/
|
||||
$type = $this->_extractUInt2($cmapData, 0);
|
||||
if ($type != Zend_Pdf_Cmap::TYPE_TRIMMED_TABLE) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong cmap table type',
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_TYPE);
|
||||
}
|
||||
|
||||
$length = $this->_extractUInt2($cmapData, 2);
|
||||
if ($length != $actualLength) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table length ($length) does not match actual length ($actualLength)",
|
||||
Zend_Pdf_Exception::CMAP_WRONG_TABLE_LENGTH);
|
||||
}
|
||||
|
||||
/* Mapping tables should be language-independent. The font may not work
|
||||
* as expected if they are not. Unfortunately, many font files in the
|
||||
* wild incorrectly record a language ID in this field, so we can't
|
||||
* call this a failure.
|
||||
*/
|
||||
$language = $this->_extractUInt2($cmapData, 4);
|
||||
if ($language != 0) {
|
||||
// Record a warning here somehow?
|
||||
}
|
||||
|
||||
$this->_startCode = $this->_extractUInt2($cmapData, 6);
|
||||
|
||||
$entryCount = $this->_extractUInt2($cmapData, 8);
|
||||
$expectedCount = ($length - 10) >> 1;
|
||||
if ($entryCount != $expectedCount) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Entry count is wrong; expected: $expectedCount; actual: $entryCount",
|
||||
Zend_Pdf_Exception::CMAP_WRONG_ENTRY_COUNT);
|
||||
}
|
||||
|
||||
$this->_endCode = $this->_startCode + $entryCount - 1;
|
||||
|
||||
$offset = 10;
|
||||
for ($i = 0; $i < $entryCount; $i++, $offset += 2) {
|
||||
$this->_glyphIndexArray[] = $this->_extractUInt2($cmapData, $offset);
|
||||
}
|
||||
|
||||
/* Sanity check: After reading all of the data, we should be at the end
|
||||
* of the table.
|
||||
*/
|
||||
if ($offset != $length) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Ending offset ($offset) does not match length ($length)",
|
||||
Zend_Pdf_Exception::CMAP_FINAL_OFFSET_NOT_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Cmap/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Cmap/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
53
modules/ruch/libraries/Zend/Pdf/Color.php
Normal file
53
modules/ruch/libraries/Zend/Pdf/Color.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Color.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PDF provides a powerfull facilities for specifying the colors of graphics objects.
|
||||
* This class encapsulates color behaviour.
|
||||
*
|
||||
* Some colors interact with PDF document (create additional objects in a PDF),
|
||||
* others don't do it. That is defined in a subclasses.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Pdf_Color
|
||||
{
|
||||
/**
|
||||
* Instructions, which can be directly inserted into content stream
|
||||
* to switch color.
|
||||
* Color set instructions differ for stroking and nonstroking operations.
|
||||
*
|
||||
* @param boolean $stroking
|
||||
* @return string
|
||||
*/
|
||||
abstract public function instructions($stroking);
|
||||
|
||||
/**
|
||||
* Get color components (color space dependent)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract public function getComponents();
|
||||
}
|
||||
|
||||
126
modules/ruch/libraries/Zend/Pdf/Color/Cmyk.php
Normal file
126
modules/ruch/libraries/Zend/Pdf/Color/Cmyk.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Cmyk.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/**
|
||||
* CMYK color implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Cyan level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_c;
|
||||
|
||||
/**
|
||||
* Magenta level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_m;
|
||||
|
||||
/**
|
||||
* Yellow level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_y;
|
||||
|
||||
/**
|
||||
* Key (BlacK) level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_k;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param float $c
|
||||
* @param float $m
|
||||
* @param float $y
|
||||
* @param float $k
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions, which can be directly inserted into content stream
|
||||
* to switch color.
|
||||
* Color set instructions differ for stroking and nonstroking operations.
|
||||
*
|
||||
* @param boolean $stroking
|
||||
* @return string
|
||||
*/
|
||||
public function instructions($stroking)
|
||||
{
|
||||
return $this->_c->toString() . ' '
|
||||
. $this->_m->toString() . ' '
|
||||
. $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);
|
||||
}
|
||||
}
|
||||
|
||||
84
modules/ruch/libraries/Zend/Pdf/Color/GrayScale.php
Normal file
84
modules/ruch/libraries/Zend/Pdf/Color/GrayScale.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GrayScale.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/**
|
||||
* GrayScale color implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* GrayLevel.
|
||||
* 0.0 (black) - 1.0 (white)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_grayLevel;
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param float $grayLevel
|
||||
*/
|
||||
public function __construct($grayLevel)
|
||||
{
|
||||
if ($grayLevel < 0) { $grayLevel = 0; }
|
||||
if ($grayLevel > 1) { $grayLevel = 1; }
|
||||
|
||||
$this->_grayLevel = new Zend_Pdf_Element_Numeric($grayLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions, which can be directly inserted into content stream
|
||||
* to switch color.
|
||||
* Color set instructions differ for stroking and nonstroking operations.
|
||||
*
|
||||
* @param boolean $stroking
|
||||
* @return string
|
||||
*/
|
||||
public function instructions($stroking)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
412
modules/ruch/libraries/Zend/Pdf/Color/Html.php
Normal file
412
modules/ruch/libraries/Zend/Pdf/Color/Html.php
Normal file
@@ -0,0 +1,412 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Html.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
|
||||
/**
|
||||
* HTML color implementation
|
||||
*
|
||||
* Factory class which vends Zend_Pdf_Color objects from typical HTML
|
||||
* representations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
|
||||
/**
|
||||
* Color
|
||||
*
|
||||
* @var Zend_Pdf_Color
|
||||
*/
|
||||
private $_color;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param mixed $color
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($color)
|
||||
{
|
||||
$this->_color = self::color($color);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instructions, which can be directly inserted into content stream
|
||||
* to switch color.
|
||||
* Color set instructions differ for stroking and nonstroking operations.
|
||||
*
|
||||
* @param boolean $stroking
|
||||
* @return string
|
||||
*/
|
||||
public function instructions($stroking)
|
||||
{
|
||||
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.
|
||||
*
|
||||
* @param string $color May either be a hexidecimal number of the form
|
||||
* #rrggbb or one of the 140 well-known names (black, white, blue, etc.)
|
||||
* @return Zend_Pdf_Color
|
||||
*/
|
||||
public static function color($color)
|
||||
{
|
||||
$pattern = '/^#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})$/';
|
||||
if (preg_match($pattern, $color, $matches)) {
|
||||
$r = round((hexdec($matches[1]) / 255), 3);
|
||||
$g = round((hexdec($matches[2]) / 255), 3);
|
||||
$b = round((hexdec($matches[3]) / 255), 3);
|
||||
if (($r == $g) && ($g == $b)) {
|
||||
require_once 'Zend/Pdf/Color/GrayScale.php';
|
||||
return new Zend_Pdf_Color_GrayScale($r);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Color/Rgb.php';
|
||||
return new Zend_Pdf_Color_Rgb($r, $g, $b);
|
||||
}
|
||||
} else {
|
||||
return Zend_Pdf_Color_Html::namedColor($color);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Zend_Pdf_Color object from the named color.
|
||||
*
|
||||
* @param string $color One of the 140 well-known color names (black, white,
|
||||
* blue, etc.)
|
||||
* @return Zend_Pdf_Color
|
||||
*/
|
||||
public static function namedColor($color)
|
||||
{
|
||||
switch (strtolower($color)) {
|
||||
case 'aqua':
|
||||
$r = 0.0; $g = 1.0; $b = 1.0; break;
|
||||
case 'black':
|
||||
$r = 0.0; $g = 0.0; $b = 0.0; break;
|
||||
case 'blue':
|
||||
$r = 0.0; $g = 0.0; $b = 1.0; break;
|
||||
case 'fuchsia':
|
||||
$r = 1.0; $g = 0.0; $b = 1.0; break;
|
||||
case 'gray':
|
||||
$r = 0.502; $g = 0.502; $b = 0.502; break;
|
||||
case 'green':
|
||||
$r = 0.0; $g = 0.502; $b = 0.0; break;
|
||||
case 'lime':
|
||||
$r = 0.0; $g = 1.0; $b = 0.0; break;
|
||||
case 'maroon':
|
||||
$r = 0.502; $g = 0.0; $b = 0.0; break;
|
||||
case 'navy':
|
||||
$r = 0.0; $g = 0.0; $b = 0.502; break;
|
||||
case 'olive':
|
||||
$r = 0.502; $g = 0.502; $b = 0.0; break;
|
||||
case 'purple':
|
||||
$r = 0.502; $g = 0.0; $b = 0.502; break;
|
||||
case 'red':
|
||||
$r = 1.0; $g = 0.0; $b = 0.0; break;
|
||||
case 'silver':
|
||||
$r = 0.753; $g = 0.753; $b = 0.753; break;
|
||||
case 'teal':
|
||||
$r = 0.0; $g = 0.502; $b = 0.502; break;
|
||||
case 'white':
|
||||
$r = 1.0; $g = 1.0; $b = 1.0; break;
|
||||
case 'yellow':
|
||||
$r = 1.0; $g = 1.0; $b = 0.0; break;
|
||||
|
||||
case 'aliceblue':
|
||||
$r = 0.941; $g = 0.973; $b = 1.0; break;
|
||||
case 'antiquewhite':
|
||||
$r = 0.980; $g = 0.922; $b = 0.843; break;
|
||||
case 'aquamarine':
|
||||
$r = 0.498; $g = 1.0; $b = 0.831; break;
|
||||
case 'azure':
|
||||
$r = 0.941; $g = 1.0; $b = 1.0; break;
|
||||
case 'beige':
|
||||
$r = 0.961; $g = 0.961; $b = 0.863; break;
|
||||
case 'bisque':
|
||||
$r = 1.0; $g = 0.894; $b = 0.769; break;
|
||||
case 'blanchedalmond':
|
||||
$r = 1.0; $g = 1.0; $b = 0.804; break;
|
||||
case 'blueviolet':
|
||||
$r = 0.541; $g = 0.169; $b = 0.886; break;
|
||||
case 'brown':
|
||||
$r = 0.647; $g = 0.165; $b = 0.165; break;
|
||||
case 'burlywood':
|
||||
$r = 0.871; $g = 0.722; $b = 0.529; break;
|
||||
case 'cadetblue':
|
||||
$r = 0.373; $g = 0.620; $b = 0.627; break;
|
||||
case 'chartreuse':
|
||||
$r = 0.498; $g = 1.0; $b = 0.0; break;
|
||||
case 'chocolate':
|
||||
$r = 0.824; $g = 0.412; $b = 0.118; break;
|
||||
case 'coral':
|
||||
$r = 1.0; $g = 0.498; $b = 0.314; break;
|
||||
case 'cornflowerblue':
|
||||
$r = 0.392; $g = 0.584; $b = 0.929; break;
|
||||
case 'cornsilk':
|
||||
$r = 1.0; $g = 0.973; $b = 0.863; break;
|
||||
case 'crimson':
|
||||
$r = 0.863; $g = 0.078; $b = 0.235; break;
|
||||
case 'cyan':
|
||||
$r = 0.0; $g = 1.0; $b = 1.0; break;
|
||||
case 'darkblue':
|
||||
$r = 0.0; $g = 0.0; $b = 0.545; break;
|
||||
case 'darkcyan':
|
||||
$r = 0.0; $g = 0.545; $b = 0.545; break;
|
||||
case 'darkgoldenrod':
|
||||
$r = 0.722; $g = 0.525; $b = 0.043; break;
|
||||
case 'darkgray':
|
||||
$r = 0.663; $g = 0.663; $b = 0.663; break;
|
||||
case 'darkgreen':
|
||||
$r = 0.0; $g = 0.392; $b = 0.0; break;
|
||||
case 'darkkhaki':
|
||||
$r = 0.741; $g = 0.718; $b = 0.420; break;
|
||||
case 'darkmagenta':
|
||||
$r = 0.545; $g = 0.0; $b = 0.545; break;
|
||||
case 'darkolivegreen':
|
||||
$r = 0.333; $g = 0.420; $b = 0.184; break;
|
||||
case 'darkorange':
|
||||
$r = 1.0; $g = 0.549; $b = 0.0; break;
|
||||
case 'darkorchid':
|
||||
$r = 0.6; $g = 0.196; $b = 0.8; break;
|
||||
case 'darkred':
|
||||
$r = 0.545; $g = 0.0; $b = 0.0; break;
|
||||
case 'darksalmon':
|
||||
$r = 0.914; $g = 0.588; $b = 0.478; break;
|
||||
case 'darkseagreen':
|
||||
$r = 0.561; $g = 0.737; $b = 0.561; break;
|
||||
case 'darkslateblue':
|
||||
$r = 0.282; $g = 0.239; $b = 0.545; break;
|
||||
case 'darkslategray':
|
||||
$r = 0.184; $g = 0.310; $b = 0.310; break;
|
||||
case 'darkturquoise':
|
||||
$r = 0.0; $g = 0.808; $b = 0.820; break;
|
||||
case 'darkviolet':
|
||||
$r = 0.580; $g = 0.0; $b = 0.827; break;
|
||||
case 'deeppink':
|
||||
$r = 1.0; $g = 0.078; $b = 0.576; break;
|
||||
case 'deepskyblue':
|
||||
$r = 0.0; $g = 0.749; $b = 1.0; break;
|
||||
case 'dimgray':
|
||||
$r = 0.412; $g = 0.412; $b = 0.412; break;
|
||||
case 'dodgerblue':
|
||||
$r = 0.118; $g = 0.565; $b = 1.0; break;
|
||||
case 'firebrick':
|
||||
$r = 0.698; $g = 0.133; $b = 0.133; break;
|
||||
case 'floralwhite':
|
||||
$r = 1.0; $g = 0.980; $b = 0.941; break;
|
||||
case 'forestgreen':
|
||||
$r = 0.133; $g = 0.545; $b = 0.133; break;
|
||||
case 'gainsboro':
|
||||
$r = 0.863; $g = 0.863; $b = 0.863; break;
|
||||
case 'ghostwhite':
|
||||
$r = 0.973; $g = 0.973; $b = 1.0; break;
|
||||
case 'gold':
|
||||
$r = 1.0; $g = 0.843; $b = 0.0; break;
|
||||
case 'goldenrod':
|
||||
$r = 0.855; $g = 0.647; $b = 0.125; break;
|
||||
case 'greenyellow':
|
||||
$r = 0.678; $g = 1.0; $b = 0.184; break;
|
||||
case 'honeydew':
|
||||
$r = 0.941; $g = 1.0; $b = 0.941; break;
|
||||
case 'hotpink':
|
||||
$r = 1.0; $g = 0.412; $b = 0.706; break;
|
||||
case 'indianred':
|
||||
$r = 0.804; $g = 0.361; $b = 0.361; break;
|
||||
case 'indigo':
|
||||
$r = 0.294; $g = 0.0; $b = 0.510; break;
|
||||
case 'ivory':
|
||||
$r = 1.0; $g = 0.941; $b = 0.941; break;
|
||||
case 'khaki':
|
||||
$r = 0.941; $g = 0.902; $b = 0.549; break;
|
||||
case 'lavender':
|
||||
$r = 0.902; $g = 0.902; $b = 0.980; break;
|
||||
case 'lavenderblush':
|
||||
$r = 1.0; $g = 0.941; $b = 0.961; break;
|
||||
case 'lawngreen':
|
||||
$r = 0.486; $g = 0.988; $b = 0.0; break;
|
||||
case 'lemonchiffon':
|
||||
$r = 1.0; $g = 0.980; $b = 0.804; break;
|
||||
case 'lightblue':
|
||||
$r = 0.678; $g = 0.847; $b = 0.902; break;
|
||||
case 'lightcoral':
|
||||
$r = 0.941; $g = 0.502; $b = 0.502; break;
|
||||
case 'lightcyan':
|
||||
$r = 0.878; $g = 1.0; $b = 1.0; break;
|
||||
case 'lightgoldenrodyellow':
|
||||
$r = 0.980; $g = 0.980; $b = 0.824; break;
|
||||
case 'lightgreen':
|
||||
$r = 0.565; $g = 0.933; $b = 0.565; break;
|
||||
case 'lightgrey':
|
||||
$r = 0.827; $g = 0.827; $b = 0.827; break;
|
||||
case 'lightpink':
|
||||
$r = 1.0; $g = 0.714; $b = 0.757; break;
|
||||
case 'lightsalmon':
|
||||
$r = 1.0; $g = 0.627; $b = 0.478; break;
|
||||
case 'lightseagreen':
|
||||
$r = 0.125; $g = 0.698; $b = 0.667; break;
|
||||
case 'lightskyblue':
|
||||
$r = 0.529; $g = 0.808; $b = 0.980; break;
|
||||
case 'lightslategray':
|
||||
$r = 0.467; $g = 0.533; $b = 0.6; break;
|
||||
case 'lightsteelblue':
|
||||
$r = 0.690; $g = 0.769; $b = 0.871; break;
|
||||
case 'lightyellow':
|
||||
$r = 1.0; $g = 1.0; $b = 0.878; break;
|
||||
case 'limegreen':
|
||||
$r = 0.196; $g = 0.804; $b = 0.196; break;
|
||||
case 'linen':
|
||||
$r = 0.980; $g = 0.941; $b = 0.902; break;
|
||||
case 'magenta':
|
||||
$r = 1.0; $g = 0.0; $b = 1.0; break;
|
||||
case 'mediumaquamarine':
|
||||
$r = 0.4; $g = 0.804; $b = 0.667; break;
|
||||
case 'mediumblue':
|
||||
$r = 0.0; $g = 0.0; $b = 0.804; break;
|
||||
case 'mediumorchid':
|
||||
$r = 0.729; $g = 0.333; $b = 0.827; break;
|
||||
case 'mediumpurple':
|
||||
$r = 0.576; $g = 0.439; $b = 0.859; break;
|
||||
case 'mediumseagreen':
|
||||
$r = 0.235; $g = 0.702; $b = 0.443; break;
|
||||
case 'mediumslateblue':
|
||||
$r = 0.482; $g = 0.408; $b = 0.933; break;
|
||||
case 'mediumspringgreen':
|
||||
$r = 0.0; $g = 0.980; $b = 0.604; break;
|
||||
case 'mediumturquoise':
|
||||
$r = 0.282; $g = 0.820; $b = 0.8; break;
|
||||
case 'mediumvioletred':
|
||||
$r = 0.780; $g = 0.082; $b = 0.522; break;
|
||||
case 'midnightblue':
|
||||
$r = 0.098; $g = 0.098; $b = 0.439; break;
|
||||
case 'mintcream':
|
||||
$r = 0.961; $g = 1.0; $b = 0.980; break;
|
||||
case 'mistyrose':
|
||||
$r = 1.0; $g = 0.894; $b = 0.882; break;
|
||||
case 'moccasin':
|
||||
$r = 1.0; $g = 0.894; $b = 0.710; break;
|
||||
case 'navajowhite':
|
||||
$r = 1.0; $g = 0.871; $b = 0.678; break;
|
||||
case 'oldlace':
|
||||
$r = 0.992; $g = 0.961; $b = 0.902; break;
|
||||
case 'olivedrab':
|
||||
$r = 0.420; $g = 0.557; $b = 0.137; break;
|
||||
case 'orange':
|
||||
$r = 1.0; $g = 0.647; $b = 0.0; break;
|
||||
case 'orangered':
|
||||
$r = 1.0; $g = 0.271; $b = 0.0; break;
|
||||
case 'orchid':
|
||||
$r = 0.855; $g = 0.439; $b = 0.839; break;
|
||||
case 'palegoldenrod':
|
||||
$r = 0.933; $g = 0.910; $b = 0.667; break;
|
||||
case 'palegreen':
|
||||
$r = 0.596; $g = 0.984; $b = 0.596; break;
|
||||
case 'paleturquoise':
|
||||
$r = 0.686; $g = 0.933; $b = 0.933; break;
|
||||
case 'palevioletred':
|
||||
$r = 0.859; $g = 0.439; $b = 0.576; break;
|
||||
case 'papayawhip':
|
||||
$r = 1.0; $g = 0.937; $b = 0.835; break;
|
||||
case 'peachpuff':
|
||||
$r = 1.0; $g = 0.937; $b = 0.835; break;
|
||||
case 'peru':
|
||||
$r = 0.804; $g = 0.522; $b = 0.247; break;
|
||||
case 'pink':
|
||||
$r = 1.0; $g = 0.753; $b = 0.796; break;
|
||||
case 'plum':
|
||||
$r = 0.867; $g = 0.627; $b = 0.867; break;
|
||||
case 'powderblue':
|
||||
$r = 0.690; $g = 0.878; $b = 0.902; break;
|
||||
case 'rosybrown':
|
||||
$r = 0.737; $g = 0.561; $b = 0.561; break;
|
||||
case 'royalblue':
|
||||
$r = 0.255; $g = 0.412; $b = 0.882; break;
|
||||
case 'saddlebrown':
|
||||
$r = 0.545; $g = 0.271; $b = 0.075; break;
|
||||
case 'salmon':
|
||||
$r = 0.980; $g = 0.502; $b = 0.447; break;
|
||||
case 'sandybrown':
|
||||
$r = 0.957; $g = 0.643; $b = 0.376; break;
|
||||
case 'seagreen':
|
||||
$r = 0.180; $g = 0.545; $b = 0.341; break;
|
||||
case 'seashell':
|
||||
$r = 1.0; $g = 0.961; $b = 0.933; break;
|
||||
case 'sienna':
|
||||
$r = 0.627; $g = 0.322; $b = 0.176; break;
|
||||
case 'skyblue':
|
||||
$r = 0.529; $g = 0.808; $b = 0.922; break;
|
||||
case 'slateblue':
|
||||
$r = 0.416; $g = 0.353; $b = 0.804; break;
|
||||
case 'slategray':
|
||||
$r = 0.439; $g = 0.502; $b = 0.565; break;
|
||||
case 'snow':
|
||||
$r = 1.0; $g = 0.980; $b = 0.980; break;
|
||||
case 'springgreen':
|
||||
$r = 0.0; $g = 1.0; $b = 0.498; break;
|
||||
case 'steelblue':
|
||||
$r = 0.275; $g = 0.510; $b = 0.706; break;
|
||||
case 'tan':
|
||||
$r = 0.824; $g = 0.706; $b = 0.549; break;
|
||||
case 'thistle':
|
||||
$r = 0.847; $g = 0.749; $b = 0.847; break;
|
||||
case 'tomato':
|
||||
$r = 0.992; $g = 0.388; $b = 0.278; break;
|
||||
case 'turquoise':
|
||||
$r = 0.251; $g = 0.878; $b = 0.816; break;
|
||||
case 'violet':
|
||||
$r = 0.933; $g = 0.510; $b = 0.933; break;
|
||||
case 'wheat':
|
||||
$r = 0.961; $g = 0.871; $b = 0.702; break;
|
||||
case 'whitesmoke':
|
||||
$r = 0.961; $g = 0.961; $b = 0.961; break;
|
||||
case 'yellowgreen':
|
||||
$r = 0.604; $g = 0.804; $b = 0.196; break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown color name: ' . $color);
|
||||
}
|
||||
if (($r == $g) && ($g == $b)) {
|
||||
require_once 'Zend/Pdf/Color/GrayScale.php';
|
||||
return new Zend_Pdf_Color_GrayScale($r);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Color/Rgb.php';
|
||||
return new Zend_Pdf_Color_Rgb($r, $g, $b);
|
||||
}
|
||||
}
|
||||
}
|
||||
114
modules/ruch/libraries/Zend/Pdf/Color/Rgb.php
Normal file
114
modules/ruch/libraries/Zend/Pdf/Color/Rgb.php
Normal 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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Rgb.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/**
|
||||
* RGB color implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Red level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_r;
|
||||
|
||||
/**
|
||||
* Green level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_g;
|
||||
|
||||
/**
|
||||
* Blue level.
|
||||
* 0.0 (zero concentration) - 1.0 (maximum concentration)
|
||||
*
|
||||
* @var Zend_Pdf_Element_Numeric
|
||||
*/
|
||||
private $_b;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param float $r
|
||||
* @param float $g
|
||||
* @param float $b
|
||||
*/
|
||||
public function __construct($r, $g, $b)
|
||||
{
|
||||
/** Clamp values to legal limits. */
|
||||
if ($r < 0) { $r = 0; }
|
||||
if ($r > 1) { $r = 1; }
|
||||
|
||||
if ($g < 0) { $g = 0; }
|
||||
if ($g > 1) { $g = 1; }
|
||||
|
||||
if ($b < 0) { $b = 0; }
|
||||
if ($b > 1) { $b = 1; }
|
||||
|
||||
$this->_r = new Zend_Pdf_Element_Numeric($r);
|
||||
$this->_g = new Zend_Pdf_Element_Numeric($g);
|
||||
$this->_b = new Zend_Pdf_Element_Numeric($b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instructions, which can be directly inserted into content stream
|
||||
* to switch color.
|
||||
* Color set instructions differ for stroking and nonstroking operations.
|
||||
*
|
||||
* @param boolean $stroking
|
||||
* @return string
|
||||
*/
|
||||
public function instructions($stroking)
|
||||
{
|
||||
return $this->_r->toString() . ' '
|
||||
. $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);
|
||||
}
|
||||
}
|
||||
|
||||
9
modules/ruch/libraries/Zend/Pdf/Color/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Color/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
113
modules/ruch/libraries/Zend/Pdf/Destination.php
Normal file
113
modules/ruch/libraries/Zend/Pdf/Destination.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Destination.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Target */
|
||||
require_once 'Zend/Pdf/Target.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract PDF destination representation class
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2011 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 Zend_Pdf_Element $resource
|
||||
* @return Zend_Pdf_Destination
|
||||
*/
|
||||
public static function load(Zend_Pdf_Element $resource)
|
||||
{
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
122
modules/ruch/libraries/Zend/Pdf/Destination/Explicit.php
Normal file
122
modules/ruch/libraries/Zend/Pdf/Destination/Explicit.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Explicit.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.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-2011 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;
|
||||
}
|
||||
}
|
||||
75
modules/ruch/libraries/Zend/Pdf/Destination/Fit.php
Normal file
75
modules/ruch/libraries/Zend/Pdf/Destination/Fit.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Fit.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBox.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBoxHorizontally.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBoxVertically.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitHorizontally.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
}
|
||||
171
modules/ruch/libraries/Zend/Pdf/Destination/FitRectangle.php
Normal file
171
modules/ruch/libraries/Zend/Pdf/Destination/FitRectangle.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitRectangle.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitVertically.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
}
|
||||
101
modules/ruch/libraries/Zend/Pdf/Destination/Named.php
Normal file
101
modules/ruch/libraries/Zend/Pdf/Destination/Named.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Named.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** 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-2011 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 Zend_Pdf_Element $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;
|
||||
}
|
||||
}
|
||||
37
modules/ruch/libraries/Zend/Pdf/Destination/Unknown.php
Normal file
37
modules/ruch/libraries/Zend/Pdf/Destination/Unknown.php
Normal 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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Unknown.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** 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-2011 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
|
||||
{
|
||||
}
|
||||
177
modules/ruch/libraries/Zend/Pdf/Destination/Zoom.php
Normal file
177
modules/ruch/libraries/Zend/Pdf/Destination/Zoom.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?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-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Zoom.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** 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-2011 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;
|
||||
}
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Destination/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Destination/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
176
modules/ruch/libraries/Zend/Pdf/Element.php
Normal file
176
modules/ruch/libraries/Zend/Pdf/Element.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Element.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PDF file element implementation
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Pdf_Element
|
||||
{
|
||||
const TYPE_BOOL = 1;
|
||||
const TYPE_NUMERIC = 2;
|
||||
const TYPE_STRING = 3;
|
||||
const TYPE_NAME = 4;
|
||||
const TYPE_ARRAY = 5;
|
||||
const TYPE_DICTIONARY = 6;
|
||||
const TYPE_STREAM = 7;
|
||||
const TYPE_NULL = 11;
|
||||
|
||||
/**
|
||||
* Reference to the top level indirect object, which contains this element.
|
||||
*
|
||||
* @var Zend_Pdf_Element_Object
|
||||
*/
|
||||
private $_parentObject = null;
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
* See ZPdfPDFConst for possible values
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
abstract public function getType();
|
||||
|
||||
/**
|
||||
* Convert element to a string, which can be directly
|
||||
* written to a PDF file.
|
||||
*
|
||||
* $factory parameter defines operation context.
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
abstract public function toString($factory = null);
|
||||
|
||||
const CLONE_MODE_SKIP_PAGES = 1; // Do not follow pages during deep copy process
|
||||
const CLONE_MODE_FORCE_CLONING = 2; // Force top level object cloning even it's already processed
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @todo It's nevessry to check if SplObjectStorage class works faster
|
||||
* (Needs PHP 5.3.x to attach object _with_ additional data to storage)
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
return clone $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set top level parent indirect object.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $parent
|
||||
*/
|
||||
public function setParentObject(Zend_Pdf_Element_Object $parent)
|
||||
{
|
||||
$this->_parentObject = $parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get top level parent indirect object.
|
||||
*
|
||||
* @return Zend_Pdf_Element_Object
|
||||
*/
|
||||
public function getParentObject()
|
||||
{
|
||||
return $this->_parentObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mark object as modified, to include it into new PDF file segment.
|
||||
*
|
||||
* We don't automate this action to keep control on PDF update process.
|
||||
* All new objects are treated as "modified" automatically.
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
if ($this->_parentObject !== null) {
|
||||
$this->_parentObject->touch();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up resources, used by object
|
||||
*/
|
||||
public function cleanUp()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PDF element to PHP type.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function toPhp()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PHP value into PDF element.
|
||||
*
|
||||
* @param mixed $input
|
||||
* @return Zend_Pdf_Element
|
||||
*/
|
||||
public static function phpToPdf($input)
|
||||
{
|
||||
if (is_numeric($input)) {
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
return new Zend_Pdf_Element_Numeric($input);
|
||||
} else if (is_bool($input)) {
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
return new Zend_Pdf_Element_Boolean($input);
|
||||
} else if (is_array($input)) {
|
||||
$pdfElementsArray = array();
|
||||
$isDictionary = false;
|
||||
|
||||
foreach ($input as $key => $value) {
|
||||
if (is_string($key)) {
|
||||
$isDictionary = true;
|
||||
}
|
||||
$pdfElementsArray[$key] = Zend_Pdf_Element::phpToPdf($value);
|
||||
}
|
||||
|
||||
if ($isDictionary) {
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
return new Zend_Pdf_Element_Dictionary($pdfElementsArray);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
return new Zend_Pdf_Element_Array($pdfElementsArray);
|
||||
}
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
return new Zend_Pdf_Element_String((string)$input);
|
||||
}
|
||||
}
|
||||
}
|
||||
181
modules/ruch/libraries/Zend/Pdf/Element/Array.php
Normal file
181
modules/ruch/libraries/Zend/Pdf/Element/Array.php
Normal file
@@ -0,0 +1,181 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Array.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'array' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Array element items
|
||||
*
|
||||
* Array of Zend_Pdf_Element objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $items;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param array $val - array of Zend_Pdf_Element objects
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($val = null)
|
||||
{
|
||||
$this->items = new ArrayObject();
|
||||
|
||||
if ($val !== null && is_array($val)) {
|
||||
foreach ($val as $element) {
|
||||
if (!$element instanceof Zend_Pdf_Element) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
|
||||
}
|
||||
$this->items[] = $element;
|
||||
}
|
||||
} else if ($val !== null){
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Argument must be an array');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Getter
|
||||
*
|
||||
* @param string $property
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __get($property) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter
|
||||
*
|
||||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __set($property, $value) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Undefined property: Zend_Pdf_Element_Array::$' . $property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_ARRAY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
$outStr = '[';
|
||||
$lastNL = 0;
|
||||
|
||||
foreach ($this->items as $element) {
|
||||
if (strlen($outStr) - $lastNL > 128) {
|
||||
$outStr .= "\n";
|
||||
$lastNL = strlen($outStr);
|
||||
}
|
||||
|
||||
$outStr .= $element->toString($factory) . ' ';
|
||||
}
|
||||
$outStr .= ']';
|
||||
|
||||
return $outStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
$newArray = new self();
|
||||
|
||||
foreach ($this->items as $key => $value) {
|
||||
$newArray->items[$key] = $value->makeClone($factory, $processed, $mode);
|
||||
}
|
||||
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set top level parent indirect object.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $parent
|
||||
*/
|
||||
public function setParentObject(Zend_Pdf_Element_Object $parent)
|
||||
{
|
||||
parent::setParentObject($parent);
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
$item->setParentObject($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PDF element to PHP type.
|
||||
*
|
||||
* Dictionary is returned as an associative array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function toPhp()
|
||||
{
|
||||
$phpArray = array();
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
$phpArray[] = $item->toPhp();
|
||||
}
|
||||
|
||||
return $phpArray;
|
||||
}
|
||||
}
|
||||
83
modules/ruch/libraries/Zend/Pdf/Element/Boolean.php
Normal file
83
modules/ruch/libraries/Zend/Pdf/Element/Boolean.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Boolean.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'boolean' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param boolean $val
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($val)
|
||||
{
|
||||
if (! is_bool($val)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Argument must be boolean.');
|
||||
}
|
||||
|
||||
$this->value = $val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_BOOL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return $this->value ? 'true' : 'false';
|
||||
}
|
||||
}
|
||||
236
modules/ruch/libraries/Zend/Pdf/Element/Dictionary.php
Normal file
236
modules/ruch/libraries/Zend/Pdf/Element/Dictionary.php
Normal file
@@ -0,0 +1,236 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Dictionary.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* PDF file 'dictionary' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Dictionary elements
|
||||
* Array of Zend_Pdf_Element objects ('name' => Zend_Pdf_Element)
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_items = array();
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param array $val - array of Zend_Pdf_Element objects
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($val = null)
|
||||
{
|
||||
if ($val === null) {
|
||||
return;
|
||||
} else if (!is_array($val)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Argument must be an array');
|
||||
}
|
||||
|
||||
foreach ($val as $name => $element) {
|
||||
if (!$element instanceof Zend_Pdf_Element) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Array elements must be Zend_Pdf_Element objects');
|
||||
}
|
||||
if (!is_string($name)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Array keys must be strings');
|
||||
}
|
||||
$this->_items[$name] = $element;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add element to an array
|
||||
*
|
||||
* @name Zend_Pdf_Element_Name $name
|
||||
* @param Zend_Pdf_Element $val - Zend_Pdf_Element object
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function add(Zend_Pdf_Element_Name $name, Zend_Pdf_Element $val)
|
||||
{
|
||||
$this->_items[$name->value] = $val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return dictionary keys
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getKeys()
|
||||
{
|
||||
return array_keys($this->_items);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get handler
|
||||
*
|
||||
* @param string $property
|
||||
* @return Zend_Pdf_Element | null
|
||||
*/
|
||||
public function __get($item)
|
||||
{
|
||||
$element = isset($this->_items[$item]) ? $this->_items[$item]
|
||||
: null;
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set handler
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($item, $value)
|
||||
{
|
||||
if ($value === null) {
|
||||
unset($this->_items[$item]);
|
||||
} else {
|
||||
$this->_items[$item] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_DICTIONARY;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
$outStr = '<<';
|
||||
$lastNL = 0;
|
||||
|
||||
foreach ($this->_items as $name => $element) {
|
||||
if (!is_object($element)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong data');
|
||||
}
|
||||
|
||||
if (strlen($outStr) - $lastNL > 128) {
|
||||
$outStr .= "\n";
|
||||
$lastNL = strlen($outStr);
|
||||
}
|
||||
|
||||
$nameObj = new Zend_Pdf_Element_Name($name);
|
||||
$outStr .= $nameObj->toString($factory) . ' ' . $element->toString($factory) . ' ';
|
||||
}
|
||||
$outStr .= '>>';
|
||||
|
||||
return $outStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
if (isset($this->_items['Type'])) {
|
||||
if ($this->_items['Type']->value == 'Pages') {
|
||||
// It's a page tree node
|
||||
// skip it and its children
|
||||
return new Zend_Pdf_Element_Null();
|
||||
}
|
||||
|
||||
if ($this->_items['Type']->value == 'Page' &&
|
||||
$mode == Zend_Pdf_Element::CLONE_MODE_SKIP_PAGES
|
||||
) {
|
||||
// It's a page node, skip it
|
||||
return new Zend_Pdf_Element_Null();
|
||||
}
|
||||
}
|
||||
|
||||
$newDictionary = new self();
|
||||
foreach ($this->_items as $key => $value) {
|
||||
$newDictionary->_items[$key] = $value->makeClone($factory, $processed, $mode);
|
||||
}
|
||||
|
||||
return $newDictionary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set top level parent indirect object.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $parent
|
||||
*/
|
||||
public function setParentObject(Zend_Pdf_Element_Object $parent)
|
||||
{
|
||||
parent::setParentObject($parent);
|
||||
|
||||
foreach ($this->_items as $item) {
|
||||
$item->setParentObject($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PDF element to PHP type.
|
||||
*
|
||||
* Dictionary is returned as an associative array
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function toPhp()
|
||||
{
|
||||
$phpArray = array();
|
||||
|
||||
foreach ($this->_items as $itemName => $item) {
|
||||
$phpArray[$itemName] = $item->toPhp();
|
||||
}
|
||||
|
||||
return $phpArray;
|
||||
}
|
||||
}
|
||||
161
modules/ruch/libraries/Zend/Pdf/Element/Name.php
Normal file
161
modules/ruch/libraries/Zend/Pdf/Element/Name.php
Normal file
@@ -0,0 +1,161 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Name.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'name' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param string $val
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($val)
|
||||
{
|
||||
settype($val, 'string');
|
||||
if (strpos($val,"\x00") !== false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Null character is not allowed in PDF Names');
|
||||
}
|
||||
$this->value = (string)$val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_NAME;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($inStr)
|
||||
{
|
||||
$outStr = '';
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
$nextCode = ord($inStr[$count]);
|
||||
|
||||
switch ($inStr[$count]) {
|
||||
case '(':
|
||||
// fall through to next case
|
||||
case ')':
|
||||
// fall through to next case
|
||||
case '<':
|
||||
// fall through to next case
|
||||
case '>':
|
||||
// fall through to next case
|
||||
case '[':
|
||||
// fall through to next case
|
||||
case ']':
|
||||
// fall through to next case
|
||||
case '{':
|
||||
// fall through to next case
|
||||
case '}':
|
||||
// fall through to next case
|
||||
case '/':
|
||||
// fall through to next case
|
||||
case '%':
|
||||
// fall through to next case
|
||||
case '\\':
|
||||
// fall through to next case
|
||||
case '#':
|
||||
$outStr .= sprintf('#%02X', $nextCode);
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($nextCode >= 33 && $nextCode <= 126 ) {
|
||||
// Visible ASCII symbol
|
||||
$outStr .= $inStr[$count];
|
||||
} else {
|
||||
$outStr .= sprintf('#%02X', $nextCode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $outStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unescape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @return string
|
||||
*/
|
||||
public static function unescape($inStr)
|
||||
{
|
||||
$outStr = '';
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
if ($inStr[$count] != '#' ) {
|
||||
$outStr .= $inStr[$count];
|
||||
} else {
|
||||
// Escape sequence
|
||||
$outStr .= chr(base_convert(substr($inStr, $count+1, 2), 16, 10 ));
|
||||
$count +=2;
|
||||
}
|
||||
}
|
||||
return $outStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return '/' . self::escape((string)$this->value);
|
||||
}
|
||||
}
|
||||
75
modules/ruch/libraries/Zend/Pdf/Element/Null.php
Normal file
75
modules/ruch/libraries/Zend/Pdf/Element/Null.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Null.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'null' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value. Always null.
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->value = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return 'null';
|
||||
}
|
||||
}
|
||||
95
modules/ruch/libraries/Zend/Pdf/Element/Numeric.php
Normal file
95
modules/ruch/libraries/Zend/Pdf/Element/Numeric.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Numeric.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'numeric' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var numeric
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param numeric $val
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_NUMERIC;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
if (is_integer($this->value)) {
|
||||
return (string)$this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* PDF doesn't support exponental format.
|
||||
* Fixed point format must be used instead
|
||||
*/
|
||||
$prec = 0; $v = $this->value;
|
||||
while (abs( floor($v) - $v ) > 1e-10) {
|
||||
$prec++; $v *= 10;
|
||||
}
|
||||
return sprintf("%.{$prec}F", $this->value);
|
||||
}
|
||||
}
|
||||
284
modules/ruch/libraries/Zend/Pdf/Element/Object.php
Normal file
284
modules/ruch/libraries/Zend/Pdf/Element/Object.php
Normal file
@@ -0,0 +1,284 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Object.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'indirect object' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var Zend_Pdf_Element
|
||||
*/
|
||||
protected $_value;
|
||||
|
||||
/**
|
||||
* Object number within PDF file
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_objNum;
|
||||
|
||||
/**
|
||||
* Generation number
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_genNum;
|
||||
|
||||
/**
|
||||
* Reference to the factory.
|
||||
*
|
||||
* @var Zend_Pdf_ElementFactory
|
||||
*/
|
||||
protected $_factory;
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param Zend_Pdf_Element $val
|
||||
* @param integer $objNum
|
||||
* @param integer $genNum
|
||||
* @param Zend_Pdf_ElementFactory $factory
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
|
||||
{
|
||||
if ($val instanceof self) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object number must not be an instance of Zend_Pdf_Element_Object.');
|
||||
}
|
||||
|
||||
if ( !(is_integer($objNum) && $objNum > 0) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object number must be positive integer.');
|
||||
}
|
||||
|
||||
if ( !(is_integer($genNum) && $genNum >= 0) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Generation number must be non-negative integer.');
|
||||
}
|
||||
|
||||
$this->_value = $val;
|
||||
$this->_objNum = $objNum;
|
||||
$this->_genNum = $genNum;
|
||||
$this->_factory = $factory;
|
||||
|
||||
$this->setParentObject($this);
|
||||
|
||||
$factory->registerObject($this, $objNum . ' ' . $genNum);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check, that object is generated by specified factory
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory
|
||||
*/
|
||||
public function getFactory()
|
||||
{
|
||||
return $this->_factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_value->getType();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get object number
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getObjNum()
|
||||
{
|
||||
return $this->_objNum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get generation number
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getGenNum()
|
||||
{
|
||||
return $this->_genNum;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return reference to the object
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
if ($factory === null) {
|
||||
$shift = 0;
|
||||
} else {
|
||||
$shift = $factory->getEnumerationShift($this->_factory);
|
||||
}
|
||||
|
||||
return $this->_objNum + $shift . ' ' . $this->_genNum . ' R';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dump object to a string to save within PDF file.
|
||||
*
|
||||
* $factory parameter defines operation context.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function dump(Zend_Pdf_ElementFactory $factory)
|
||||
{
|
||||
$shift = $factory->getEnumerationShift($this->_factory);
|
||||
|
||||
return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
|
||||
. $this->_value->toString($factory) . "\n"
|
||||
. "endobj\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get handler
|
||||
*
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
return $this->_value->$property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set handler
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
$this->_value->$property = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call handler
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
return call_user_func_array(array($this->_value, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
$id = spl_object_hash($this);
|
||||
if (isset($processed[$id])) {
|
||||
// Do nothing if object is already processed
|
||||
// return it
|
||||
return $processed[$id];
|
||||
}
|
||||
|
||||
// Create obect with null value and register it in $processed container
|
||||
$processed[$id] = $clonedObject = $factory->newObject(new Zend_Pdf_Element_Null());
|
||||
|
||||
// Pecursively process actual data
|
||||
$clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
|
||||
|
||||
if ($clonedObject->_value instanceof Zend_Pdf_Element_Null) {
|
||||
// Do not store null objects within $processed container since it may be filtered
|
||||
// by $mode parameter but used in some future pass
|
||||
unset($processed[$id]);
|
||||
|
||||
// Return direct null object
|
||||
return $clonedObject->_value;
|
||||
}
|
||||
|
||||
return $clonedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark object as modified, to include it into new PDF file segment
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
$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
|
||||
*/
|
||||
public function cleanUp()
|
||||
{
|
||||
$this->_value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PDF element to PHP type.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function toPhp()
|
||||
{
|
||||
return $this->_value->toPhp();
|
||||
}
|
||||
}
|
||||
453
modules/ruch/libraries/Zend/Pdf/Element/Object/Stream.php
Normal file
453
modules/ruch/libraries/Zend/Pdf/Element/Object/Stream.php
Normal file
@@ -0,0 +1,453 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Stream.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/**
|
||||
* PDF file 'stream object' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* StreamObject dictionary
|
||||
* Required enries:
|
||||
* Length
|
||||
*
|
||||
* @var Zend_Pdf_Element_Dictionary
|
||||
*/
|
||||
private $_dictionary;
|
||||
|
||||
/**
|
||||
* Flag which signals, that stream is decoded
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $_streamDecoded;
|
||||
|
||||
/**
|
||||
* Stored original stream object dictionary.
|
||||
* Used to decode stream at access time.
|
||||
*
|
||||
* The only properties affecting decoding are sored here.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
private $_initialDictionaryData = null;
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param mixed $val
|
||||
* @param integer $objNum
|
||||
* @param integer $genNum
|
||||
* @param Zend_Pdf_ElementFactory $factory
|
||||
* @param Zend_Pdf_Element_Dictionary|null $dictionary
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory, $dictionary = null)
|
||||
{
|
||||
parent::__construct(new Zend_Pdf_Element_Stream($val), $objNum, $genNum, $factory);
|
||||
|
||||
if ($dictionary === null) {
|
||||
$this->_dictionary = new Zend_Pdf_Element_Dictionary();
|
||||
$this->_dictionary->Length = new Zend_Pdf_Element_Numeric(strlen( $val ));
|
||||
$this->_streamDecoded = true;
|
||||
} else {
|
||||
$this->_dictionary = $dictionary;
|
||||
$this->_streamDecoded = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Extract dictionary data which are used to store information and to normalize filters
|
||||
* information before defiltering.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function _extractDictionaryData()
|
||||
{
|
||||
$dictionaryArray = array();
|
||||
|
||||
$dictionaryArray['Filter'] = array();
|
||||
$dictionaryArray['DecodeParms'] = array();
|
||||
if ($this->_dictionary->Filter === null) {
|
||||
// Do nothing.
|
||||
} else if ($this->_dictionary->Filter->getType() == Zend_Pdf_Element::TYPE_ARRAY) {
|
||||
foreach ($this->_dictionary->Filter->items as $id => $filter) {
|
||||
$dictionaryArray['Filter'][$id] = $filter->value;
|
||||
$dictionaryArray['DecodeParms'][$id] = array();
|
||||
|
||||
if ($this->_dictionary->DecodeParms !== null ) {
|
||||
if ($this->_dictionary->DecodeParms->items[$id] !== null &&
|
||||
$this->_dictionary->DecodeParms->items[$id]->value !== null ) {
|
||||
foreach ($this->_dictionary->DecodeParms->items[$id]->getKeys() as $paramKey) {
|
||||
$dictionaryArray['DecodeParms'][$id][$paramKey] =
|
||||
$this->_dictionary->DecodeParms->items[$id]->$paramKey->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($this->_dictionary->Filter->getType() != Zend_Pdf_Element::TYPE_NULL) {
|
||||
$dictionaryArray['Filter'][0] = $this->_dictionary->Filter->value;
|
||||
$dictionaryArray['DecodeParms'][0] = array();
|
||||
if ($this->_dictionary->DecodeParms !== null ) {
|
||||
foreach ($this->_dictionary->DecodeParms->getKeys() as $paramKey) {
|
||||
$dictionaryArray['DecodeParms'][0][$paramKey] =
|
||||
$this->_dictionary->DecodeParms->$paramKey->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->_dictionary->F !== null) {
|
||||
$dictionaryArray['F'] = $this->_dictionary->F->value;
|
||||
}
|
||||
|
||||
$dictionaryArray['FFilter'] = array();
|
||||
$dictionaryArray['FDecodeParms'] = array();
|
||||
if ($this->_dictionary->FFilter === null) {
|
||||
// Do nothing.
|
||||
} else if ($this->_dictionary->FFilter->getType() == Zend_Pdf_Element::TYPE_ARRAY) {
|
||||
foreach ($this->_dictionary->FFilter->items as $id => $filter) {
|
||||
$dictionaryArray['FFilter'][$id] = $filter->value;
|
||||
$dictionaryArray['FDecodeParms'][$id] = array();
|
||||
|
||||
if ($this->_dictionary->FDecodeParms !== null ) {
|
||||
if ($this->_dictionary->FDecodeParms->items[$id] !== null &&
|
||||
$this->_dictionary->FDecodeParms->items[$id]->value !== null) {
|
||||
foreach ($this->_dictionary->FDecodeParms->items[$id]->getKeys() as $paramKey) {
|
||||
$dictionaryArray['FDecodeParms'][$id][$paramKey] =
|
||||
$this->_dictionary->FDecodeParms->items[$id]->items[$paramKey]->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$dictionaryArray['FFilter'][0] = $this->_dictionary->FFilter->value;
|
||||
$dictionaryArray['FDecodeParms'][0] = array();
|
||||
if ($this->_dictionary->FDecodeParms !== null ) {
|
||||
foreach ($this->_dictionary->FDecodeParms->getKeys() as $paramKey) {
|
||||
$dictionaryArray['FDecodeParms'][0][$paramKey] =
|
||||
$this->_dictionary->FDecodeParms->items[$paramKey]->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $dictionaryArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode stream
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private function _decodeStream()
|
||||
{
|
||||
if ($this->_initialDictionaryData === null) {
|
||||
$this->_initialDictionaryData = $this->_extractDictionaryData();
|
||||
}
|
||||
|
||||
/**
|
||||
* All applied stream filters must be processed to decode stream.
|
||||
* If we don't recognize any of applied filetrs an exception should be thrown here
|
||||
*/
|
||||
if (isset($this->_initialDictionaryData['F'])) {
|
||||
/** @todo Check, how external files can be processed. */
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('External filters are not supported now.');
|
||||
}
|
||||
|
||||
foreach ($this->_initialDictionaryData['Filter'] as $id => $filterName ) {
|
||||
$valueRef = &$this->_value->value->getRef();
|
||||
$this->_value->value->touch();
|
||||
switch ($filterName) {
|
||||
case 'ASCIIHexDecode':
|
||||
require_once 'Zend/Pdf/Filter/AsciiHex.php';
|
||||
$valueRef = Zend_Pdf_Filter_AsciiHex::decode($valueRef);
|
||||
break;
|
||||
|
||||
case 'ASCII85Decode':
|
||||
require_once 'Zend/Pdf/Filter/Ascii85.php';
|
||||
$valueRef = Zend_Pdf_Filter_Ascii85::decode($valueRef);
|
||||
break;
|
||||
|
||||
case 'FlateDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Flate.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Flate::decode($valueRef,
|
||||
$this->_initialDictionaryData['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'LZWDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef,
|
||||
$this->_initialDictionaryData['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'RunLengthDecode':
|
||||
require_once 'Zend/Pdf/Filter/RunLength.php';
|
||||
$valueRef = Zend_Pdf_Filter_RunLength::decode($valueRef);
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_streamDecoded = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode stream
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private function _encodeStream()
|
||||
{
|
||||
/**
|
||||
* All applied stream filters must be processed to encode stream.
|
||||
* If we don't recognize any of applied filetrs an exception should be thrown here
|
||||
*/
|
||||
if (isset($this->_initialDictionaryData['F'])) {
|
||||
/** @todo Check, how external files can be processed. */
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('External filters are not supported now.');
|
||||
}
|
||||
|
||||
$filters = array_reverse($this->_initialDictionaryData['Filter'], true);
|
||||
|
||||
foreach ($filters as $id => $filterName ) {
|
||||
$valueRef = &$this->_value->value->getRef();
|
||||
$this->_value->value->touch();
|
||||
switch ($filterName) {
|
||||
case 'ASCIIHexDecode':
|
||||
require_once 'Zend/Pdf/Filter/AsciiHex.php';
|
||||
$valueRef = Zend_Pdf_Filter_AsciiHex::encode($valueRef);
|
||||
break;
|
||||
|
||||
case 'ASCII85Decode':
|
||||
require_once 'Zend/Pdf/Filter/Ascii85.php';
|
||||
$valueRef = Zend_Pdf_Filter_Ascii85::encode($valueRef);
|
||||
break;
|
||||
|
||||
case 'FlateDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Flate.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Flate::encode($valueRef,
|
||||
$this->_initialDictionaryData['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'LZWDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Lzw::encode($valueRef,
|
||||
$this->_initialDictionaryData['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'RunLengthDecode':
|
||||
require_once 'Zend/Pdf/Filter/RunLength.php';
|
||||
$valueRef = Zend_Pdf_Filter_RunLength::encode($valueRef);
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->_streamDecoded = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get handler
|
||||
*
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ($property == 'dictionary') {
|
||||
/**
|
||||
* If stream is not decoded yet, then store original decoding options (do it only once).
|
||||
*/
|
||||
if (( !$this->_streamDecoded ) && ($this->_initialDictionaryData === null)) {
|
||||
$this->_initialDictionaryData = $this->_extractDictionaryData();
|
||||
}
|
||||
|
||||
return $this->_dictionary;
|
||||
}
|
||||
|
||||
if ($property == 'value') {
|
||||
if (!$this->_streamDecoded) {
|
||||
$this->_decodeStream();
|
||||
}
|
||||
|
||||
return $this->_value->value->getRef();
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream object property requested.');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set handler
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ($property == 'value') {
|
||||
$valueRef = &$this->_value->value->getRef();
|
||||
$valueRef = $value;
|
||||
$this->_value->value->touch();
|
||||
|
||||
$this->_streamDecoded = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream object property: \'' . $property . '\'.');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Treat stream data as already encoded
|
||||
*/
|
||||
public function skipFilters()
|
||||
{
|
||||
$this->_streamDecoded = false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call handler
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if (!$this->_streamDecoded) {
|
||||
$this->_decodeStream();
|
||||
}
|
||||
|
||||
switch (count($args)) {
|
||||
case 0:
|
||||
return $this->_value->$method();
|
||||
case 1:
|
||||
return $this->_value->$method($args[0]);
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported number of arguments');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
$id = spl_object_hash($this);
|
||||
if (isset($processed[$id])) {
|
||||
// Do nothing if object is already processed
|
||||
// return it
|
||||
return $processed[$id];
|
||||
}
|
||||
|
||||
$streamValue = $this->_value;
|
||||
$streamDictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
|
||||
|
||||
// Make new empty instance of stream object and register it in $processed container
|
||||
$processed[$id] = $clonedObject = $factory->newStreamObject('');
|
||||
|
||||
// Copy current object data and state
|
||||
$clonedObject->_dictionary = $this->_dictionary->makeClone($factory, $processed, $mode);
|
||||
$clonedObject->_value = $this->_value->makeClone($factory, $processed, $mode);
|
||||
$clonedObject->_initialDictionaryData = $this->_initialDictionaryData;
|
||||
$clonedObject->_streamDecoded = $this->_streamDecoded;
|
||||
|
||||
return $clonedObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dump object to a string to save within PDF file
|
||||
*
|
||||
* $factory parameter defines operation context.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function dump(Zend_Pdf_ElementFactory $factory)
|
||||
{
|
||||
$shift = $factory->getEnumerationShift($this->_factory);
|
||||
|
||||
if ($this->_streamDecoded) {
|
||||
$this->_initialDictionaryData = $this->_extractDictionaryData();
|
||||
$this->_encodeStream();
|
||||
} else if ($this->_initialDictionaryData != null) {
|
||||
$newDictionary = $this->_extractDictionaryData();
|
||||
|
||||
if ($this->_initialDictionaryData !== $newDictionary) {
|
||||
$this->_decodeStream();
|
||||
$this->_initialDictionaryData = $newDictionary;
|
||||
$this->_encodeStream();
|
||||
}
|
||||
}
|
||||
|
||||
// Update stream length
|
||||
$this->dictionary->Length->value = $this->_value->length();
|
||||
|
||||
return $this->_objNum + $shift . " " . $this->_genNum . " obj \n"
|
||||
. $this->dictionary->toString($factory) . "\n"
|
||||
. $this->_value->toString($factory) . "\n"
|
||||
. "endobj\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up resources, used by object
|
||||
*/
|
||||
public function cleanUp()
|
||||
{
|
||||
$this->_dictionary = null;
|
||||
$this->_value = null;
|
||||
}
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Element/Object/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Element/Object/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
303
modules/ruch/libraries/Zend/Pdf/Element/Reference.php
Normal file
303
modules/ruch/libraries/Zend/Pdf/Element/Reference.php
Normal file
@@ -0,0 +1,303 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Reference.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* PDF file 'reference' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
* The reference to the object
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
private $_ref;
|
||||
|
||||
/**
|
||||
* Object number within PDF file
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_objNum;
|
||||
|
||||
/**
|
||||
* Generation number
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_genNum;
|
||||
|
||||
/**
|
||||
* Reference context
|
||||
*
|
||||
* @var Zend_Pdf_Element_Reference_Context
|
||||
*/
|
||||
private $_context;
|
||||
|
||||
|
||||
/**
|
||||
* Reference to the factory.
|
||||
*
|
||||
* It's the same as referenced object factory, but we save it here to avoid
|
||||
* unnecessary dereferencing, whech can produce cascade dereferencing and parsing.
|
||||
* The same for duplication of getFactory() function. It can be processed by __call()
|
||||
* method, but we catch it here.
|
||||
*
|
||||
* @var Zend_Pdf_ElementFactory
|
||||
*/
|
||||
private $_factory;
|
||||
|
||||
/**
|
||||
* Object constructor:
|
||||
*
|
||||
* @param integer $objNum
|
||||
* @param integer $genNum
|
||||
* @param Zend_Pdf_Element_Reference_Context $context
|
||||
* @param Zend_Pdf_ElementFactory $factory
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($objNum, $genNum = 0, Zend_Pdf_Element_Reference_Context $context, Zend_Pdf_ElementFactory $factory)
|
||||
{
|
||||
if ( !(is_integer($objNum) && $objNum > 0) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object number must be positive integer');
|
||||
}
|
||||
if ( !(is_integer($genNum) && $genNum >= 0) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Generation number must be non-negative integer');
|
||||
}
|
||||
|
||||
$this->_objNum = $objNum;
|
||||
$this->_genNum = $genNum;
|
||||
$this->_ref = null;
|
||||
$this->_context = $context;
|
||||
$this->_factory = $factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check, that object is generated by specified factory
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory
|
||||
*/
|
||||
public function getFactory()
|
||||
{
|
||||
return $this->_factory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
return $this->_ref->getType();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return reference to the object
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
if ($factory === null) {
|
||||
$shift = 0;
|
||||
} else {
|
||||
$shift = $factory->getEnumerationShift($this->_factory);
|
||||
}
|
||||
|
||||
return $this->_objNum + $shift . ' ' . $this->_genNum . ' R';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Dereference.
|
||||
* Take inderect object, take $value member of this object (must be Zend_Pdf_Element),
|
||||
* take reference to the $value member of this object and assign it to
|
||||
* $value member of current PDF Reference object
|
||||
* $obj can be null
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private function _dereference()
|
||||
{
|
||||
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();
|
||||
return;
|
||||
}
|
||||
|
||||
if ($obj->toString() != $this->_objNum . ' ' . $this->_genNum . ' R') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Incorrect reference to the object');
|
||||
}
|
||||
|
||||
$this->_ref = $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
// This code duplicates code in Zend_Pdf_Element_Object class,
|
||||
// but allows to avoid unnecessary method call in most cases
|
||||
$id = spl_object_hash($this->_ref);
|
||||
if (isset($processed[$id])) {
|
||||
// Do nothing if object is already processed
|
||||
// return it
|
||||
return $processed[$id];
|
||||
}
|
||||
|
||||
return $this->_ref->makeClone($factory, $processed, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark object as modified, to include it into new PDF file segment.
|
||||
*/
|
||||
public function touch()
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
$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
|
||||
*
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
return $this->_ref->$property;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set handler
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
$this->_ref->$property = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call handler
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
return call_user_func_array(array($this->_ref, $method), $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up resources
|
||||
*/
|
||||
public function cleanUp()
|
||||
{
|
||||
$this->_ref = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert PDF element to PHP type.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function toPhp()
|
||||
{
|
||||
if ($this->_ref === null) {
|
||||
$this->_dereference();
|
||||
}
|
||||
|
||||
return $this->_ref->toPhp();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Context.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PDF reference object context
|
||||
* Reference context is defined by PDF parser and PDF Refernce table
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* PDF parser object.
|
||||
*
|
||||
* @var Zend_Pdf_StringParser
|
||||
*/
|
||||
private $_stringParser;
|
||||
|
||||
/**
|
||||
* Reference table
|
||||
*
|
||||
* @var Zend_Pdf_Element_Reference_Table
|
||||
*/
|
||||
private $_refTable;
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param Zend_Pdf_StringParser $parser
|
||||
* @param Zend_Pdf_Element_Reference_Table $refTable
|
||||
*/
|
||||
public function __construct(Zend_Pdf_StringParser $parser,
|
||||
Zend_Pdf_Element_Reference_Table $refTable)
|
||||
{
|
||||
$this->_stringParser = $parser;
|
||||
$this->_refTable = $refTable;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Context parser
|
||||
*
|
||||
* @return Zend_Pdf_StringParser
|
||||
*/
|
||||
public function getParser()
|
||||
{
|
||||
return $this->_stringParser;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Context reference table
|
||||
*
|
||||
* @return Zend_Pdf_Element_Reference_Table
|
||||
*/
|
||||
public function getRefTable()
|
||||
{
|
||||
return $this->_refTable;
|
||||
}
|
||||
}
|
||||
|
||||
198
modules/ruch/libraries/Zend/Pdf/Element/Reference/Table.php
Normal file
198
modules/ruch/libraries/Zend/Pdf/Element/Reference/Table.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Table.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PDF file reference table
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Parent reference table
|
||||
*
|
||||
* @var Zend_Pdf_Element_Reference_Table
|
||||
*/
|
||||
private $_parent;
|
||||
|
||||
/**
|
||||
* Free entries
|
||||
* 'reference' => next free object number
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_free;
|
||||
|
||||
/**
|
||||
* Generation numbers for free objects.
|
||||
* Array: objNum => nextGeneration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_generations;
|
||||
|
||||
/**
|
||||
* In use entries
|
||||
* 'reference' => offset
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_inuse;
|
||||
|
||||
/**
|
||||
* Generation numbers for free objects.
|
||||
* Array: objNum => objGeneration
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_usedObjects;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_parent = null;
|
||||
$this->_free = array(); $this->_generations = array();
|
||||
$this->_inuse = array(); $this->_usedObjects = array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add reference to the reference table
|
||||
*
|
||||
* @param string $ref
|
||||
* @param integer $offset
|
||||
* @param boolean $inuse
|
||||
*/
|
||||
public function addReference($ref, $offset, $inuse = true)
|
||||
{
|
||||
$refElements = explode(' ', $ref);
|
||||
if (!is_numeric($refElements[0]) || !is_numeric($refElements[1]) || $refElements[2] != 'R') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Incorrect reference: '$ref'");
|
||||
}
|
||||
$objNum = (int)$refElements[0];
|
||||
$genNum = (int)$refElements[1];
|
||||
|
||||
if ($inuse) {
|
||||
$this->_inuse[$ref] = $offset;
|
||||
$this->_usedObjects[$objNum] = $objNum;
|
||||
} else {
|
||||
$this->_free[$ref] = $offset;
|
||||
$this->_generations[$objNum] = $genNum;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set parent reference table
|
||||
*
|
||||
* @param Zend_Pdf_Element_Reference_Table $parent
|
||||
*/
|
||||
public function setParent(self $parent)
|
||||
{
|
||||
$this->_parent = $parent;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get object offset
|
||||
*
|
||||
* @param string $ref
|
||||
* @return integer
|
||||
*/
|
||||
public function getOffset($ref)
|
||||
{
|
||||
if (isset($this->_inuse[$ref])) {
|
||||
return $this->_inuse[$ref];
|
||||
}
|
||||
|
||||
if (isset($this->_free[$ref])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isset($this->_parent)) {
|
||||
return $this->_parent->getOffset($ref);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get next object from a list of free objects.
|
||||
*
|
||||
* @param string $ref
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function getNextFree($ref)
|
||||
{
|
||||
if (isset($this->_inuse[$ref])) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not free');
|
||||
}
|
||||
|
||||
if (isset($this->_free[$ref])) {
|
||||
return $this->_free[$ref];
|
||||
}
|
||||
|
||||
if (isset($this->_parent)) {
|
||||
return $this->_parent->getNextFree($ref);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object not found.');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get next generation number for free object
|
||||
*
|
||||
* @param integer $objNum
|
||||
* @return unknown
|
||||
*/
|
||||
public function getNewGeneration($objNum)
|
||||
{
|
||||
if (isset($this->_usedObjects[$objNum])) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not free');
|
||||
}
|
||||
|
||||
if (isset($this->_generations[$objNum])) {
|
||||
return $this->_generations[$objNum];
|
||||
}
|
||||
|
||||
if (isset($this->_parent)) {
|
||||
return $this->_parent->getNewGeneration($objNum);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object not found.');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
130
modules/ruch/libraries/Zend/Pdf/Element/Stream.php
Normal file
130
modules/ruch/libraries/Zend/Pdf/Element/Stream.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* PDF file 'stream' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var Zend_Memory_Container
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param string $val
|
||||
*/
|
||||
public function __construct($val)
|
||||
{
|
||||
$this->value = Zend_Pdf::getMemoryManager()->create($val);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_STREAM;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stream length.
|
||||
* (Method is used to avoid string copying, which may occurs in some cases)
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function length()
|
||||
{
|
||||
return strlen($this->value->getRef());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear stream
|
||||
*
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$ref = &$this->value->getRef();
|
||||
$ref = '';
|
||||
$this->value->touch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Append value to a stream
|
||||
*
|
||||
* @param mixed $val
|
||||
*/
|
||||
public function append($val)
|
||||
{
|
||||
$ref = &$this->value->getRef();
|
||||
$ref .= (string)$val;
|
||||
$this->value->touch();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detach PDF object from the factory (if applicable), clone it and attach to new factory.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $factory The factory to attach
|
||||
* @param array &$processed List of already processed indirect objects, used to avoid objects duplication
|
||||
* @param integer $mode Cloning mode (defines filter for objects cloning)
|
||||
* @returns Zend_Pdf_Element
|
||||
*/
|
||||
public function makeClone(Zend_Pdf_ElementFactory $factory, array &$processed, $mode)
|
||||
{
|
||||
return new self($this->value->getRef());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return "stream\n" . $this->value->getRef() . "\nendstream";
|
||||
}
|
||||
}
|
||||
263
modules/ruch/libraries/Zend/Pdf/Element/String.php
Normal file
263
modules/ruch/libraries/Zend/Pdf/Element/String.php
Normal file
@@ -0,0 +1,263 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: String.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* PDF file 'string' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param string $val
|
||||
*/
|
||||
public function __construct($val)
|
||||
{
|
||||
$this->value = (string)$val;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return type of the element.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return Zend_Pdf_Element::TYPE_STRING;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return '(' . self::escape((string)$this->value) . ')';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape string according to the PDF rules
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($str)
|
||||
{
|
||||
$outEntries = array();
|
||||
|
||||
foreach (str_split($str, 128) as $chunk) {
|
||||
// Collect sequence of unescaped characters
|
||||
$offset = strcspn($chunk, "\n\r\t\x08\x0C()\\");
|
||||
$chunkOut = substr($chunk, 0, $offset);
|
||||
|
||||
while ($offset < strlen($chunk)) {
|
||||
$nextCode = ord($chunk[$offset++]);
|
||||
switch ($nextCode) {
|
||||
// "\n" - line feed (LF)
|
||||
case 10:
|
||||
$chunkOut .= '\\n';
|
||||
break;
|
||||
|
||||
// "\r" - carriage return (CR)
|
||||
case 13:
|
||||
$chunkOut .= '\\r';
|
||||
break;
|
||||
|
||||
// "\t" - horizontal tab (HT)
|
||||
case 9:
|
||||
$chunkOut .= '\\t';
|
||||
break;
|
||||
|
||||
// "\b" - backspace (BS)
|
||||
case 8:
|
||||
$chunkOut .= '\\b';
|
||||
break;
|
||||
|
||||
// "\f" - form feed (FF)
|
||||
case 12:
|
||||
$chunkOut .= '\\f';
|
||||
break;
|
||||
|
||||
// '(' - left paranthesis
|
||||
case 40:
|
||||
$chunkOut .= '\\(';
|
||||
break;
|
||||
|
||||
// ')' - right paranthesis
|
||||
case 41:
|
||||
$chunkOut .= '\\)';
|
||||
break;
|
||||
|
||||
// '\' - backslash
|
||||
case 92:
|
||||
$chunkOut .= '\\\\';
|
||||
break;
|
||||
|
||||
default:
|
||||
// This code is never executed extually
|
||||
//
|
||||
// Don't use non-ASCII characters escaping
|
||||
// if ($nextCode >= 32 && $nextCode <= 126 ) {
|
||||
// // Visible ASCII symbol
|
||||
// $chunkEntries[] = chr($nextCode);
|
||||
// } else {
|
||||
// $chunkEntries[] = sprintf('\\%03o', $nextCode);
|
||||
// }
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Collect sequence of unescaped characters
|
||||
$start = $offset;
|
||||
$offset += strcspn($chunk, "\n\r\t\x08\x0C()\\", $offset);
|
||||
$chunkOut .= substr($chunk, $start, $offset - $start);
|
||||
}
|
||||
|
||||
$outEntries[] = $chunkOut;
|
||||
}
|
||||
|
||||
return implode("\\\n", $outEntries);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unescape string according to the PDF rules
|
||||
*
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public static function unescape($str)
|
||||
{
|
||||
$outEntries = array();
|
||||
|
||||
$offset = 0;
|
||||
while ($offset < strlen($str)) {
|
||||
// Searche for the next escaped character/sequence
|
||||
$escapeCharOffset = strpos($str, '\\', $offset);
|
||||
if ($escapeCharOffset === false || $escapeCharOffset == strlen($str) - 1) {
|
||||
// There are no escaped characters or '\' char has came at the end of string
|
||||
$outEntries[] = substr($str, $offset);
|
||||
break;
|
||||
} else {
|
||||
// Collect unescaped characters sequence
|
||||
$outEntries[] = substr($str, $offset, $escapeCharOffset - $offset);
|
||||
// Go to the escaped character
|
||||
$offset = $escapeCharOffset + 1;
|
||||
|
||||
switch ($str[$offset]) {
|
||||
// '\\n' - line feed (LF)
|
||||
case 'n':
|
||||
$outEntries[] = "\n";
|
||||
break;
|
||||
|
||||
// '\\r' - carriage return (CR)
|
||||
case 'r':
|
||||
$outEntries[] = "\r";
|
||||
break;
|
||||
|
||||
// '\\t' - horizontal tab (HT)
|
||||
case 't':
|
||||
$outEntries[] = "\t";
|
||||
break;
|
||||
|
||||
// '\\b' - backspace (BS)
|
||||
case 'b':
|
||||
$outEntries[] = "\x08";
|
||||
break;
|
||||
|
||||
// '\\f' - form feed (FF)
|
||||
case 'f':
|
||||
$outEntries[] = "\x0C";
|
||||
break;
|
||||
|
||||
// '\\(' - left paranthesis
|
||||
case '(':
|
||||
$outEntries[] = '(';
|
||||
break;
|
||||
|
||||
// '\\)' - right paranthesis
|
||||
case ')':
|
||||
$outEntries[] = ')';
|
||||
break;
|
||||
|
||||
// '\\\\' - backslash
|
||||
case '\\':
|
||||
$outEntries[] = '\\';
|
||||
break;
|
||||
|
||||
// "\\\n" or "\\\n\r"
|
||||
case "\n":
|
||||
// skip new line symbol
|
||||
if ($str[$offset + 1] == "\r") {
|
||||
$offset++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (strpos('0123456789', $str[$offset]) !== false) {
|
||||
// Character in octal representation
|
||||
// '\\xxx'
|
||||
$nextCode = '0' . $str[$offset];
|
||||
|
||||
if (strpos('0123456789', $str[$offset + 1]) !== false) {
|
||||
$nextCode .= $str[++$offset];
|
||||
|
||||
if (strpos('0123456789', $str[$offset + 1]) !== false) {
|
||||
$nextCode .= $str[++$offset];
|
||||
}
|
||||
}
|
||||
|
||||
$outEntries[] = chr(octdec($nextCode));
|
||||
} else {
|
||||
$outEntries[] = $str[$offset];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$offset++;
|
||||
}
|
||||
}
|
||||
|
||||
return implode($outEntries);
|
||||
}
|
||||
|
||||
}
|
||||
98
modules/ruch/libraries/Zend/Pdf/Element/String/Binary.php
Normal file
98
modules/ruch/libraries/Zend/Pdf/Element/String/Binary.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Binary.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_String */
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'binary string' element implementation
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Object value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $value;
|
||||
|
||||
|
||||
/**
|
||||
* Escape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($inStr)
|
||||
{
|
||||
return strtoupper(bin2hex($inStr));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unescape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @return string
|
||||
*/
|
||||
public static function unescape($inStr)
|
||||
{
|
||||
$chunks = array();
|
||||
$offset = 0;
|
||||
$length = 0;
|
||||
while ($offset < strlen($inStr)) {
|
||||
// Collect hexadecimal characters
|
||||
$start = $offset;
|
||||
$offset += strspn($inStr, "0123456789abcdefABCDEF", $offset);
|
||||
$chunks[] = substr($inStr, $start, $offset - $start);
|
||||
$length += strlen(end($chunks));
|
||||
|
||||
// Skip non-hexadecimal characters
|
||||
$offset += strcspn($inStr, "0123456789abcdefABCDEF", $offset);
|
||||
}
|
||||
if ($length % 2 != 0) {
|
||||
// We have odd number of digits.
|
||||
// Final digit is assumed to be '0'
|
||||
$chunks[] = '0';
|
||||
}
|
||||
|
||||
return pack('H*' , implode($chunks));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return object as string
|
||||
*
|
||||
* @param Zend_Pdf_Factory $factory
|
||||
* @return string
|
||||
*/
|
||||
public function toString($factory = null)
|
||||
{
|
||||
return '<' . self::escape((string)$this->value) . '>';
|
||||
}
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/Element/String/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Element/String/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
9
modules/ruch/libraries/Zend/Pdf/Element/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/Element/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
446
modules/ruch/libraries/Zend/Pdf/ElementFactory.php
Normal file
446
modules/ruch/libraries/Zend/Pdf/ElementFactory.php
Normal file
@@ -0,0 +1,446 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ElementFactory.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
|
||||
/**
|
||||
* PDF element factory.
|
||||
* Responsibility is to log PDF changes
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* List of the modified objects.
|
||||
* Also contains new and removed objects
|
||||
*
|
||||
* Array: ojbectNumber => Zend_Pdf_Element_Object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_modifiedObjects = array();
|
||||
|
||||
/**
|
||||
* List of the removed objects
|
||||
*
|
||||
* Array: ojbectNumber => Zend_Pdf_Element_Object
|
||||
*
|
||||
* @var SplObjectStorage
|
||||
*/
|
||||
private $_removedObjects;
|
||||
|
||||
/**
|
||||
* List of registered objects.
|
||||
* Used for resources clean up when factory is destroyed.
|
||||
*
|
||||
* Array of Zend_Pdf_Element objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_registeredObjects = array();
|
||||
|
||||
/**
|
||||
* PDF object counter.
|
||||
* Actually it's an object number for new PDF object
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_objectCount;
|
||||
|
||||
|
||||
/**
|
||||
* List of the attached object factories.
|
||||
* Array of Zend_Pdf_ElementFactory_Interface objects
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_attachedFactories = array();
|
||||
|
||||
|
||||
/**
|
||||
* Factory internal id
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $_factoryId;
|
||||
|
||||
/**
|
||||
* Identity, used for factory id generation
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private static $_identity = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Internal cache to save calculated shifts
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_shiftCalculationCache = array();
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param integer $objCount
|
||||
*/
|
||||
public function __construct($objCount)
|
||||
{
|
||||
$this->_objectCount = (int)$objCount;
|
||||
$this->_factoryId = self::$_identity++;
|
||||
$this->_removedObjects = new SplObjectStorage();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get factory
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
public function getFactory()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory generator
|
||||
*
|
||||
* @param integer $objCount
|
||||
* @return Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
static public function createFactory($objCount)
|
||||
{
|
||||
require_once 'Zend/Pdf/ElementFactory/Proxy.php';
|
||||
return new Zend_Pdf_ElementFactory_Proxy(new Zend_Pdf_ElementFactory($objCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* Close factory and clean-up resources
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->_modifiedObjects = null;
|
||||
$this->_removedObjects = null;
|
||||
$this->_attachedFactories = null;
|
||||
|
||||
foreach ($this->_registeredObjects as $obj) {
|
||||
$obj->cleanUp();
|
||||
}
|
||||
$this->_registeredObjects = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source factory object
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory
|
||||
*/
|
||||
public function resolve()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get factory ID
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_factoryId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set object counter
|
||||
*
|
||||
* @param integer $objCount
|
||||
*/
|
||||
public function setObjectCount($objCount)
|
||||
{
|
||||
$this->_objectCount = (int)$objCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object counter
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getObjectCount()
|
||||
{
|
||||
$count = $this->_objectCount;
|
||||
|
||||
foreach ($this->_attachedFactories as $attached) {
|
||||
$count += $attached->getObjectCount() - 1; // -1 as "0" object is a special case and shared between factories
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attach factory to the current;
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
*/
|
||||
public function attach(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
if ( $factory === $this || isset($this->_attachedFactories[$factory->getId()])) {
|
||||
/**
|
||||
* Don't attach factory twice.
|
||||
* We do not check recusively because of nature of attach operation
|
||||
* (Pages are always attached to the Documents, Fonts are always attached
|
||||
* to the pages even if pages already use Document level object factory and so on)
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
$this->_attachedFactories[$factory->getId()] = $factory;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate object enumeration shift.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
* @return integer
|
||||
*/
|
||||
public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
if ($factory === $this) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (isset($this->_shiftCalculationCache[$factory->_factoryId])) {
|
||||
return $this->_shiftCalculationCache[$factory->_factoryId];
|
||||
}
|
||||
|
||||
$shift = $this->_objectCount - 1;
|
||||
|
||||
foreach ($this->_attachedFactories as $subFactory) {
|
||||
$subFactoryShift = $subFactory->calculateShift($factory);
|
||||
|
||||
if ($subFactoryShift != -1) {
|
||||
// context found
|
||||
$this->_shiftCalculationCache[$factory->_factoryId] = $shift + $subFactoryShift;
|
||||
return $shift + $subFactoryShift;
|
||||
} else {
|
||||
$shift += $subFactory->getObjectCount()-1;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_shiftCalculationCache[$factory->_factoryId] = -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean enumeration shift cache.
|
||||
* Has to be used after PDF render operation to let followed updates be correct.
|
||||
*/
|
||||
public function cleanEnumerationShiftCache()
|
||||
{
|
||||
$this->_shiftCalculationCache = array();
|
||||
|
||||
foreach ($this->_attachedFactories as $attached) {
|
||||
$attached->cleanEnumerationShiftCache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive object enumeration shift.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
if (($shift = $this->calculateShift($factory)) == -1) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong object context');
|
||||
}
|
||||
|
||||
return $shift;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark object as modified in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function markAsModified(Zend_Pdf_Element_Object $obj)
|
||||
{
|
||||
if ($obj->getFactory() !== $this) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not generated by this factory');
|
||||
}
|
||||
|
||||
$this->_modifiedObjects[$obj->getObjNum()] = $obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove object in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function remove(Zend_Pdf_Element_Object $obj)
|
||||
{
|
||||
if (!$obj->compareFactory($this)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not generated by this factory');
|
||||
}
|
||||
|
||||
$this->_modifiedObjects[$obj->getObjNum()] = $obj;
|
||||
$this->_removedObjects->attach($obj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param Zend_Pdf_Element $objectValue
|
||||
* @return Zend_Pdf_Element_Object
|
||||
*/
|
||||
public function newObject(Zend_Pdf_Element $objectValue)
|
||||
{
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
$obj = new Zend_Pdf_Element_Object($objectValue, $this->_objectCount++, 0, $this);
|
||||
$this->_modifiedObjects[$obj->getObjNum()] = $obj;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object_Stream
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param mixed $objectValue
|
||||
* @return Zend_Pdf_Element_Object_Stream
|
||||
*/
|
||||
public function newStreamObject($streamValue)
|
||||
{
|
||||
require_once 'Zend/Pdf/Element/Object/Stream.php';
|
||||
$obj = new Zend_Pdf_Element_Object_Stream($streamValue, $this->_objectCount++, 0, $this);
|
||||
$this->_modifiedObjects[$obj->getObjNum()] = $obj;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enumerate modified objects.
|
||||
* Returns array of Zend_Pdf_UpdateInfoContainer
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $rootFactory
|
||||
* @return array
|
||||
*/
|
||||
public function listModifiedObjects($rootFactory = null)
|
||||
{
|
||||
if ($rootFactory == null) {
|
||||
$rootFactory = $this;
|
||||
$shift = 0;
|
||||
} else {
|
||||
$shift = $rootFactory->getEnumerationShift($this);
|
||||
}
|
||||
|
||||
ksort($this->_modifiedObjects);
|
||||
|
||||
$result = array();
|
||||
require_once 'Zend/Pdf/UpdateInfoContainer.php';
|
||||
foreach ($this->_modifiedObjects as $objNum => $obj) {
|
||||
if ($this->_removedObjects->contains($obj)) {
|
||||
$result[$objNum+$shift] = new Zend_Pdf_UpdateInfoContainer($objNum + $shift,
|
||||
$obj->getGenNum()+1,
|
||||
true);
|
||||
} else {
|
||||
$result[$objNum+$shift] = new Zend_Pdf_UpdateInfoContainer($objNum + $shift,
|
||||
$obj->getGenNum(),
|
||||
false,
|
||||
$obj->dump($rootFactory));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->_attachedFactories as $factory) {
|
||||
$result += $factory->listModifiedObjects($rootFactory);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register object in the factory
|
||||
*
|
||||
* 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(Zend_Pdf_Element_Object $obj, $refString)
|
||||
{
|
||||
$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
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isModified()
|
||||
{
|
||||
if (count($this->_modifiedObjects) != 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($this->_attachedFactories as $subFactory) {
|
||||
if ($subFactory->isModified()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
158
modules/ruch/libraries/Zend/Pdf/ElementFactory/Interface.php
Normal file
158
modules/ruch/libraries/Zend/Pdf/ElementFactory/Interface.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* PDF element factory interface.
|
||||
* Responsibility is to log PDF changes
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Pdf_ElementFactory_Interface
|
||||
{
|
||||
/**
|
||||
* Get factory
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
public function getFactory();
|
||||
|
||||
/**
|
||||
* Close factory and clean-up resources
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function close();
|
||||
|
||||
/**
|
||||
* Get source factory object
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory
|
||||
*/
|
||||
public function resolve();
|
||||
|
||||
/**
|
||||
* Get factory ID
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* Set object counter
|
||||
*
|
||||
* @param integer $objCount
|
||||
*/
|
||||
public function setObjectCount($objCount);
|
||||
|
||||
/**
|
||||
* Get object counter
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getObjectCount();
|
||||
|
||||
/**
|
||||
* Attach factory to the current;
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
*/
|
||||
public function attach(Zend_Pdf_ElementFactory_Interface $factory);
|
||||
|
||||
/**
|
||||
* Calculate object enumeration shift.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory);
|
||||
|
||||
/**
|
||||
* Mark object as modified in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function markAsModified(Zend_Pdf_Element_Object $obj);
|
||||
|
||||
/**
|
||||
* Remove object in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function remove(Zend_Pdf_Element_Object $obj);
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param Zend_Pdf_Element $objectValue
|
||||
* @return Zend_Pdf_Element_Object
|
||||
*/
|
||||
public function newObject(Zend_Pdf_Element $objectValue);
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object_Stream
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param mixed $objectValue
|
||||
* @return Zend_Pdf_Element_Object_Stream
|
||||
*/
|
||||
public function newStreamObject($streamValue);
|
||||
|
||||
/**
|
||||
* Enumerate modified objects.
|
||||
* Returns array of Zend_Pdf_UpdateInfoContainer
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $rootFactory
|
||||
* @return array
|
||||
*/
|
||||
public function listModifiedObjects($rootFactory = null);
|
||||
|
||||
/**
|
||||
* Check if PDF file was modified
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isModified();
|
||||
}
|
||||
234
modules/ruch/libraries/Zend/Pdf/ElementFactory/Proxy.php
Normal file
234
modules/ruch/libraries/Zend/Pdf/ElementFactory/Proxy.php
Normal file
@@ -0,0 +1,234 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Proxy.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
|
||||
/**
|
||||
* PDF element factory interface.
|
||||
* Responsibility is to log PDF changes
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Factory object
|
||||
*
|
||||
* @var Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
private $_factory;
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
*/
|
||||
public function __construct(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
$this->_factory = $factory;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
$this->_factory->close();
|
||||
$this->_factory = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get factory
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
public function getFactory()
|
||||
{
|
||||
return $this->_factory->getFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
* Close factory and clean-up resources
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Get source factory object
|
||||
*
|
||||
* @return Zend_Pdf_ElementFactory
|
||||
*/
|
||||
public function resolve()
|
||||
{
|
||||
return $this->_factory->resolve();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get factory ID
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_factory->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set object counter
|
||||
*
|
||||
* @param integer $objCount
|
||||
*/
|
||||
public function setObjectCount($objCount)
|
||||
{
|
||||
$this->_factory->setObjectCount($objCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get object counter
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getObjectCount()
|
||||
{
|
||||
return $this->_factory->getObjectCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach factory to the current;
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
*/
|
||||
public function attach(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
$this->_factory->attach($factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate object enumeration shift.
|
||||
*
|
||||
* @internal
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
* @return integer
|
||||
*/
|
||||
public function calculateShift(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
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.
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory_Interface $factory
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function getEnumerationShift(Zend_Pdf_ElementFactory_Interface $factory)
|
||||
{
|
||||
return $this->_factory->getEnumerationShift($factory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark object as modified in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function markAsModified(Zend_Pdf_Element_Object $obj)
|
||||
{
|
||||
$this->_factory->markAsModified($obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove object in context of current factory.
|
||||
*
|
||||
* @param Zend_Pdf_Element_Object $obj
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function remove(Zend_Pdf_Element_Object $obj)
|
||||
{
|
||||
$this->_factory->remove($obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param Zend_Pdf_Element $objectValue
|
||||
* @return Zend_Pdf_Element_Object
|
||||
*/
|
||||
public function newObject(Zend_Pdf_Element $objectValue)
|
||||
{
|
||||
return $this->_factory->newObject($objectValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate new Zend_Pdf_Element_Object_Stream
|
||||
*
|
||||
* @todo Reusage of the freed object. It's not a support of new feature, but only improvement.
|
||||
*
|
||||
* @param mixed $objectValue
|
||||
* @return Zend_Pdf_Element_Object_Stream
|
||||
*/
|
||||
public function newStreamObject($streamValue)
|
||||
{
|
||||
return $this->_factory->newStreamObject($streamValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerate modified objects.
|
||||
* Returns array of Zend_Pdf_UpdateInfoContainer
|
||||
*
|
||||
* @param Zend_Pdf_ElementFactory $rootFactory
|
||||
* @return array
|
||||
*/
|
||||
public function listModifiedObjects($rootFactory = null)
|
||||
{
|
||||
return $this->_factory->listModifiedObjects($rootFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if PDF file was modified
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isModified()
|
||||
{
|
||||
return $this->_factory->isModified();
|
||||
}
|
||||
}
|
||||
9
modules/ruch/libraries/Zend/Pdf/ElementFactory/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/ElementFactory/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
343
modules/ruch/libraries/Zend/Pdf/Exception.php
Normal file
343
modules/ruch/libraries/Zend/Pdf/Exception.php
Normal file
@@ -0,0 +1,343 @@
|
||||
<?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 Core
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Exception */
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* Exception class for Zend_Pdf.
|
||||
*
|
||||
* If you expect a certain type of exception to be caught and handled by the
|
||||
* caller, create a constant for it here and include it in the object being
|
||||
* thrown. Example:
|
||||
*
|
||||
* throw new Zend_Pdf_Exception('foo() is not yet implemented',
|
||||
* Zend_Pdf_Exception::NOT_IMPLEMENTED);
|
||||
*
|
||||
* This allows the caller to determine the specific type of exception that was
|
||||
* thrown without resorting to parsing the descriptive text.
|
||||
*
|
||||
* IMPORTANT: Do not rely on numeric values of the constants! They are grouped
|
||||
* sequentially below for organizational purposes only. The numbers may come to
|
||||
* mean something in the future, but they are subject to renumbering at any
|
||||
* time. ALWAYS use the symbolic constant names, which are guaranteed never to
|
||||
* change, in logical checks! You have been warned.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage Core
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Class Constants ****/
|
||||
|
||||
|
||||
/* Generic Exceptions */
|
||||
|
||||
/**
|
||||
* The feature or option is planned but has not yet been implemented. It
|
||||
* should be available in a future revision of the framework.
|
||||
*/
|
||||
const NOT_IMPLEMENTED = 0x0001;
|
||||
|
||||
/**
|
||||
* The feature or option has been deprecated and will be removed in a future
|
||||
* revision of the framework. The descriptive text accompanying this
|
||||
* exception should explain how to use the replacement features or options.
|
||||
*/
|
||||
const DEPRECATED = 0x0002;
|
||||
|
||||
/**
|
||||
* Not enough paramaters were supplied to the method.
|
||||
*/
|
||||
const TOO_FEW_PARAMETERS = 0x0003;
|
||||
|
||||
/**
|
||||
* A parameter was of the wrong data type.
|
||||
*/
|
||||
const BAD_PARAMETER_TYPE = 0x0004;
|
||||
|
||||
/**
|
||||
* A parameter contained an unusable value.
|
||||
*/
|
||||
const BAD_PARAMETER_VALUE = 0x0005;
|
||||
|
||||
/**
|
||||
* A parameter value was not within the expected range.
|
||||
*/
|
||||
const PARAMETER_VALUE_OUT_OF_RANGE = 0x0006;
|
||||
|
||||
/**
|
||||
* The method that has multiple signatures could not understand the
|
||||
* number and/or types of parameters.
|
||||
*/
|
||||
const BAD_METHOD_SIGNATURE = 0x0007;
|
||||
|
||||
/**
|
||||
* An array or string index was out of range.
|
||||
*/
|
||||
const INDEX_OUT_OF_RANGE = 0x0008;
|
||||
|
||||
|
||||
|
||||
/* Filesystem I/O */
|
||||
|
||||
/**
|
||||
* The file path was unusable or invalid.
|
||||
*/
|
||||
const BAD_FILE_PATH = 0x0101;
|
||||
|
||||
/**
|
||||
* The file is not readable by the current user.
|
||||
*/
|
||||
const NOT_READABLE = 0x0102;
|
||||
|
||||
/**
|
||||
* The file is not writeable by the current user.
|
||||
*/
|
||||
const NOT_WRITEABLE = 0x0103;
|
||||
|
||||
/**
|
||||
* The file resource has been closed unexpectedly.
|
||||
*/
|
||||
const FILE_NOT_OPEN = 0x0104;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to open the file.
|
||||
*/
|
||||
const CANT_OPEN_FILE = 0x0105;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to obtain the current file
|
||||
* position.
|
||||
*/
|
||||
const CANT_GET_FILE_POSITION = 0x0106;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to set a new file position.
|
||||
*/
|
||||
const CANT_SET_FILE_POSITION = 0x0107;
|
||||
|
||||
/**
|
||||
* An attempt was made to move the current file position before the start
|
||||
* of the file.
|
||||
*/
|
||||
const MOVE_BEFORE_START_OF_FILE = 0x0108;
|
||||
|
||||
/**
|
||||
* An attempt was made to move the current file position beyond the end of
|
||||
* the file.
|
||||
*/
|
||||
const MOVE_BEYOND_END_OF_FILE = 0x0109;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to obtain the file size.
|
||||
*/
|
||||
const CANT_GET_FILE_SIZE = 0x010a;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to read data from the file.
|
||||
*/
|
||||
const ERROR_DURING_READ = 0x010b;
|
||||
|
||||
/**
|
||||
* An error was encountered while attempting to write data to the file.
|
||||
*/
|
||||
const ERROR_DURING_WRITE = 0x010c;
|
||||
|
||||
/**
|
||||
* An incompatible page size was specified for a buffered read operation.
|
||||
*/
|
||||
const INVALID_PAGE_SIZE = 0x010d;
|
||||
|
||||
/**
|
||||
* There is insufficient data to fulfill the read request.
|
||||
*/
|
||||
const INSUFFICIENT_DATA = 0x010e;
|
||||
|
||||
|
||||
|
||||
/* Zend_Pdf_FileParser */
|
||||
|
||||
/**
|
||||
* The file parser data source object was invalid or improperly initialized.
|
||||
*/
|
||||
const BAD_DATA_SOURCE = 0x0201;
|
||||
|
||||
/**
|
||||
* An unknown byte order was specified.
|
||||
*/
|
||||
const INVALID_BYTE_ORDER = 0x0202;
|
||||
|
||||
/**
|
||||
* An invalid integer size was specified.
|
||||
*/
|
||||
const INVALID_INTEGER_SIZE = 0x0203;
|
||||
|
||||
/**
|
||||
* An invalid fixed-point number size was specified.
|
||||
*/
|
||||
const BAD_FIXED_POINT_SIZE = 0x0204;
|
||||
|
||||
/**
|
||||
* The string cannot be read.
|
||||
*/
|
||||
const CANT_READ_STRING = 0x0205;
|
||||
|
||||
/**
|
||||
* This file type must be parsed in a specific order and a parsing method
|
||||
* was called out-of-turn.
|
||||
*/
|
||||
const PARSED_OUT_OF_ORDER = 0x0206;
|
||||
|
||||
|
||||
|
||||
/* Zend_Pdf_FileParser_Font and Subclasses */
|
||||
|
||||
/**
|
||||
* The font file type is incorrect.
|
||||
*/
|
||||
const WRONG_FONT_TYPE = 0x0301;
|
||||
|
||||
/**
|
||||
* The number of tables contained in the font is outside the expected range.
|
||||
*/
|
||||
const BAD_TABLE_COUNT = 0x0302;
|
||||
|
||||
/**
|
||||
* A required table was not present in the font.
|
||||
*/
|
||||
const REQUIRED_TABLE_NOT_FOUND = 0x0303;
|
||||
|
||||
/**
|
||||
* The parser does not understand this version of this table in the font.
|
||||
*/
|
||||
const DONT_UNDERSTAND_TABLE_VERSION = 0x0303;
|
||||
|
||||
/**
|
||||
* The magic number in the font file is incorrect.
|
||||
*/
|
||||
const BAD_MAGIC_NUMBER = 0x0304;
|
||||
|
||||
/**
|
||||
* Could not locate a usable character map for this font.
|
||||
*/
|
||||
const CANT_FIND_GOOD_CMAP = 0x0305;
|
||||
|
||||
|
||||
|
||||
/* Zend_Pdf_Cmap and Subclasses */
|
||||
|
||||
/**
|
||||
* The character map type is currently unsupported.
|
||||
*/
|
||||
const CMAP_TYPE_UNSUPPORTED = 0x0401;
|
||||
|
||||
/**
|
||||
* The type of the character map is not understood.
|
||||
*/
|
||||
const CMAP_UNKNOWN_TYPE = 0x0402;
|
||||
|
||||
/**
|
||||
* The character map table data is too small.
|
||||
*/
|
||||
const CMAP_TABLE_DATA_TOO_SMALL = 0x0403;
|
||||
|
||||
/**
|
||||
* The character map table data is for a different type of table.
|
||||
*/
|
||||
const CMAP_WRONG_TABLE_TYPE = 0x0404;
|
||||
|
||||
/**
|
||||
* The character map table data contains in incorrect length.
|
||||
*/
|
||||
const CMAP_WRONG_TABLE_LENGTH = 0x0405;
|
||||
|
||||
/**
|
||||
* This character map table is language-dependent. Character maps must be
|
||||
* language-independent.
|
||||
*/
|
||||
const CMAP_NOT_LANGUAGE_INDEPENDENT = 0x0406;
|
||||
|
||||
/**
|
||||
* The final byte offset when reading the character map table data does not
|
||||
* match the reported length of the table.
|
||||
*/
|
||||
const CMAP_FINAL_OFFSET_NOT_LENGTH = 0x0407;
|
||||
|
||||
/**
|
||||
* The character map subtable entry count does not match the expected value.
|
||||
*/
|
||||
const CMAP_WRONG_ENTRY_COUNT = 0x0408;
|
||||
|
||||
|
||||
|
||||
/* Zend_Pdf_Resource_Font and Subclasses */
|
||||
|
||||
/**
|
||||
* The specified glyph number is out of range for this font.
|
||||
*/
|
||||
const GLYPH_OUT_OF_RANGE = 0x0501;
|
||||
|
||||
/**
|
||||
* This font program has copyright bits set which prevent it from being
|
||||
* embedded in the PDF file. You must specify the no-embed option to use
|
||||
* this font.
|
||||
*/
|
||||
const FONT_CANT_BE_EMBEDDED = 0x0502;
|
||||
|
||||
|
||||
|
||||
/* Zend_Pdf_Font */
|
||||
|
||||
/**
|
||||
* The font name did not match any previously instantiated font and is not
|
||||
* one of the standard 14 PDF fonts.
|
||||
*/
|
||||
const BAD_FONT_NAME = 0x0601;
|
||||
|
||||
/**
|
||||
* The factory method could not determine the type of the font file.
|
||||
*/
|
||||
const CANT_DETERMINE_FONT_TYPE = 0x0602;
|
||||
|
||||
|
||||
/* Text Layout System */
|
||||
|
||||
/**
|
||||
* The specified attribute value for the text object cannot be used.
|
||||
*/
|
||||
const BAD_ATTRIBUTE_VALUE = 0x0701;
|
||||
|
||||
|
||||
/* Zend_Pdf_Image and Subclasses */
|
||||
|
||||
const CANT_DETERMINE_IMAGE_TYPE = 0x0801;
|
||||
const WRONG_IMAGE_TYPE = 0x0802;
|
||||
const UNSUPPORTED_IMAGE_ENCODING_OPTIONS = 0x0803;
|
||||
const IMAGE_FILE_CORRUPT = 0x0804;
|
||||
|
||||
|
||||
}
|
||||
|
||||
485
modules/ruch/libraries/Zend/Pdf/FileParser.php
Normal file
485
modules/ruch/libraries/Zend/Pdf/FileParser.php
Normal file
@@ -0,0 +1,485 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FileParser.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract utility class for parsing binary files.
|
||||
*
|
||||
* Provides a library of methods to quickly navigate and extract various data
|
||||
* types (signed and unsigned integers, floating- and fixed-point numbers,
|
||||
* strings, etc.) from the file.
|
||||
*
|
||||
* File access is managed via a {@link Zend_Pdf_FileParserDataSource} object.
|
||||
* This allows the same parser code to work with many different data sources:
|
||||
* in-memory objects, filesystem files, etc.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Pdf_FileParser
|
||||
{
|
||||
/**** Class Constants ****/
|
||||
|
||||
/**
|
||||
* Little-endian byte order (0x04 0x03 0x02 0x01).
|
||||
*/
|
||||
const BYTE_ORDER_LITTLE_ENDIAN = 0;
|
||||
|
||||
/**
|
||||
* Big-endian byte order (0x01 0x02 0x03 0x04).
|
||||
*/
|
||||
const BYTE_ORDER_BIG_ENDIAN = 1;
|
||||
|
||||
|
||||
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* Flag indicating that the file has passed a cursory validation check.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_isScreened = false;
|
||||
|
||||
/**
|
||||
* Flag indicating that the file has been sucessfully parsed.
|
||||
* @var boolean
|
||||
*/
|
||||
protected $_isParsed = false;
|
||||
|
||||
/**
|
||||
* Object representing the data source to be parsed.
|
||||
* @var Zend_Pdf_FileParserDataSource
|
||||
*/
|
||||
protected $_dataSource = null;
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Abstract Methods */
|
||||
|
||||
/**
|
||||
* Performs a cursory check to verify that the binary file is in the expected
|
||||
* format. Intended to quickly weed out obviously bogus files.
|
||||
*
|
||||
* Must set $this->_isScreened to true if successful.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
abstract public function screen();
|
||||
|
||||
/**
|
||||
* Reads and parses the complete binary file.
|
||||
*
|
||||
* Must set $this->_isParsed to true if successful.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
abstract public function parse();
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
* Verifies that the data source has been properly initialized.
|
||||
*
|
||||
* @param Zend_Pdf_FileParserDataSource $dataSource
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct(Zend_Pdf_FileParserDataSource $dataSource)
|
||||
{
|
||||
if ($dataSource->getSize() == 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('The data source has not been properly initialized',
|
||||
Zend_Pdf_Exception::BAD_DATA_SOURCE);
|
||||
}
|
||||
$this->_dataSource = $dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object destructor.
|
||||
*
|
||||
* Discards the data source object.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->_dataSource = null;
|
||||
}
|
||||
|
||||
|
||||
/* Accessors */
|
||||
|
||||
/**
|
||||
* Returns true if the file has passed a cursory validation check.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isScreened()
|
||||
{
|
||||
return $this->_isScreened;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the file has been successfully parsed.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isParsed()
|
||||
{
|
||||
return $this->_isParsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the data source object representing the file being parsed.
|
||||
*
|
||||
* @return Zend_Pdf_FileParserDataSource
|
||||
*/
|
||||
public function getDataSource()
|
||||
{
|
||||
return $this->_dataSource;
|
||||
}
|
||||
|
||||
|
||||
/* Primitive Methods */
|
||||
|
||||
/**
|
||||
* Convenience wrapper for the data source object's moveToOffset() method.
|
||||
*
|
||||
* @param integer $offset Destination byte offset.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function moveToOffset($offset)
|
||||
{
|
||||
$this->_dataSource->moveToOffset($offset);
|
||||
}
|
||||
|
||||
public function getOffset() {
|
||||
return $this->_dataSource->getOffset();
|
||||
}
|
||||
|
||||
public function getSize() {
|
||||
return $this->_dataSource->getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper for the data source object's readBytes() method.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to read.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readBytes($byteCount)
|
||||
{
|
||||
return $this->_dataSource->readBytes($byteCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper for the data source object's skipBytes() method.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to skip.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function skipBytes($byteCount)
|
||||
{
|
||||
$this->_dataSource->skipBytes($byteCount);
|
||||
}
|
||||
|
||||
|
||||
/* Parser Methods */
|
||||
|
||||
/**
|
||||
* Reads the signed integer value from the binary file at the current byte
|
||||
* offset.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* @param integer $size Size of integer in bytes: 1-4
|
||||
* @param integer $byteOrder (optional) Big- or little-endian byte order.
|
||||
* Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}.
|
||||
* If omitted, uses big-endian.
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readInt($size, $byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN)
|
||||
{
|
||||
if (($size < 1) || ($size > 4)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid signed integer size: $size",
|
||||
Zend_Pdf_Exception::INVALID_INTEGER_SIZE);
|
||||
}
|
||||
$bytes = $this->_dataSource->readBytes($size);
|
||||
/* unpack() will not work for this method because it always works in
|
||||
* the host byte order for signed integers. It also does not allow for
|
||||
* variable integer sizes.
|
||||
*/
|
||||
if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) {
|
||||
$number = ord($bytes[0]);
|
||||
if (($number & 0x80) == 0x80) {
|
||||
/* This number is negative. Extract the positive equivalent.
|
||||
*/
|
||||
$number = (~ $number) & 0xff;
|
||||
for ($i = 1; $i < $size; $i++) {
|
||||
$number = ($number << 8) | ((~ ord($bytes[$i])) & 0xff);
|
||||
}
|
||||
/* Now turn this back into a negative number by taking the
|
||||
* two's complement (we didn't add one above so won't
|
||||
* subtract it below). This works reliably on both 32- and
|
||||
* 64-bit systems.
|
||||
*/
|
||||
$number = ~$number;
|
||||
} else {
|
||||
for ($i = 1; $i < $size; $i++) {
|
||||
$number = ($number << 8) | ord($bytes[$i]);
|
||||
}
|
||||
}
|
||||
} else if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_LITTLE_ENDIAN) {
|
||||
$number = ord($bytes[$size - 1]);
|
||||
if (($number & 0x80) == 0x80) {
|
||||
/* Negative number. See discussion above.
|
||||
*/
|
||||
$number = 0;
|
||||
for ($i = --$size; $i >= 0; $i--) {
|
||||
$number |= ((~ ord($bytes[$i])) & 0xff) << ($i * 8);
|
||||
}
|
||||
$number = ~$number;
|
||||
} else {
|
||||
$number = 0;
|
||||
for ($i = --$size; $i >= 0; $i--) {
|
||||
$number |= ord($bytes[$i]) << ($i * 8);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid byte order: $byteOrder",
|
||||
Zend_Pdf_Exception::INVALID_BYTE_ORDER);
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the unsigned integer value from the binary file at the current byte
|
||||
* offset.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the
|
||||
* resulting value WILL BE SIGNED because PHP uses signed integers internally
|
||||
* for everything. To guarantee portability, be sure to use bitwise operators
|
||||
* operators on large unsigned integers!
|
||||
*
|
||||
* @param integer $size Size of integer in bytes: 1-4
|
||||
* @param integer $byteOrder (optional) Big- or little-endian byte order.
|
||||
* Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}.
|
||||
* If omitted, uses big-endian.
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readUInt($size, $byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN)
|
||||
{
|
||||
if (($size < 1) || ($size > 4)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid unsigned integer size: $size",
|
||||
Zend_Pdf_Exception::INVALID_INTEGER_SIZE);
|
||||
}
|
||||
$bytes = $this->_dataSource->readBytes($size);
|
||||
/* unpack() is a bit heavyweight for this simple conversion. Just
|
||||
* work the bytes directly.
|
||||
*/
|
||||
if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) {
|
||||
$number = ord($bytes[0]);
|
||||
for ($i = 1; $i < $size; $i++) {
|
||||
$number = ($number << 8) | ord($bytes[$i]);
|
||||
}
|
||||
} else if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_LITTLE_ENDIAN) {
|
||||
$number = 0;
|
||||
for ($i = --$size; $i >= 0; $i--) {
|
||||
$number |= ord($bytes[$i]) << ($i * 8);
|
||||
}
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid byte order: $byteOrder",
|
||||
Zend_Pdf_Exception::INVALID_BYTE_ORDER);
|
||||
}
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified bit is set in the integer bitfield.
|
||||
*
|
||||
* @param integer $bit Bit number to test (i.e. - 0-31)
|
||||
* @param integer $bitField
|
||||
* @return boolean
|
||||
*/
|
||||
public function isBitSet($bit, $bitField)
|
||||
{
|
||||
$bitMask = 1 << $bit;
|
||||
$isSet = (($bitField & $bitMask) == $bitMask);
|
||||
return $isSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the signed fixed-point number from the binary file at the current
|
||||
* byte offset.
|
||||
*
|
||||
* Common fixed-point sizes are 2.14 and 16.16.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* @param integer $mantissaBits Number of bits in the mantissa
|
||||
* @param integer $fractionBits Number of bits in the fraction
|
||||
* @param integer $byteOrder (optional) Big- or little-endian byte order.
|
||||
* Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}.
|
||||
* If omitted, uses big-endian.
|
||||
* @return float
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readFixed($mantissaBits, $fractionBits,
|
||||
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN)
|
||||
{
|
||||
$bitsToRead = $mantissaBits + $fractionBits;
|
||||
if (($bitsToRead % 8) !== 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Fixed-point numbers are whole bytes',
|
||||
Zend_Pdf_Exception::BAD_FIXED_POINT_SIZE);
|
||||
}
|
||||
$number = $this->readInt(($bitsToRead >> 3), $byteOrder) / (1 << $fractionBits);
|
||||
return $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Unicode UTF-16-encoded string from the binary file at the
|
||||
* current byte offset.
|
||||
*
|
||||
* The byte order of the UTF-16 string must be specified. You must also
|
||||
* supply the desired resulting character set.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* @todo Consider changing $byteCount to a character count. They are not
|
||||
* always equivalent (in the case of surrogates).
|
||||
* @todo Make $byteOrder optional if there is a byte-order mark (BOM) in the
|
||||
* string being extracted.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes (characters * 2) to return.
|
||||
* @param integer $byteOrder (optional) Big- or little-endian byte order.
|
||||
* Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}.
|
||||
* If omitted, uses big-endian.
|
||||
* @param string $characterSet (optional) Desired resulting character set.
|
||||
* You may use any character set supported by {@link iconv()}. If omitted,
|
||||
* uses 'current locale'.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringUTF16($byteCount,
|
||||
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN,
|
||||
$characterSet = '')
|
||||
{
|
||||
if ($byteCount == 0) {
|
||||
return '';
|
||||
}
|
||||
$bytes = $this->_dataSource->readBytes($byteCount);
|
||||
if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN) {
|
||||
if ($characterSet == 'UTF-16BE') {
|
||||
return $bytes;
|
||||
}
|
||||
return iconv('UTF-16BE', $characterSet, $bytes);
|
||||
} else if ($byteOrder == Zend_Pdf_FileParser::BYTE_ORDER_LITTLE_ENDIAN) {
|
||||
if ($characterSet == 'UTF-16LE') {
|
||||
return $bytes;
|
||||
}
|
||||
return iconv('UTF-16LE', $characterSet, $bytes);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid byte order: $byteOrder",
|
||||
Zend_Pdf_Exception::INVALID_BYTE_ORDER);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Mac Roman-encoded string from the binary file at the current
|
||||
* byte offset.
|
||||
*
|
||||
* You must supply the desired resulting character set.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes (characters) to return.
|
||||
* @param string $characterSet (optional) Desired resulting character set.
|
||||
* You may use any character set supported by {@link iconv()}. If omitted,
|
||||
* uses 'current locale'.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringMacRoman($byteCount, $characterSet = '')
|
||||
{
|
||||
if ($byteCount == 0) {
|
||||
return '';
|
||||
}
|
||||
$bytes = $this->_dataSource->readBytes($byteCount);
|
||||
if ($characterSet == 'MacRoman') {
|
||||
return $bytes;
|
||||
}
|
||||
return iconv('MacRoman', $characterSet, $bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Pascal string from the binary file at the current byte offset.
|
||||
*
|
||||
* The length of the Pascal string is determined by reading the length bytes
|
||||
* which preceed the character data. You must supply the desired resulting
|
||||
* character set.
|
||||
*
|
||||
* Advances the offset by the number of bytes read. Throws an exception if
|
||||
* an error occurs.
|
||||
*
|
||||
* @param string $characterSet (optional) Desired resulting character set.
|
||||
* You may use any character set supported by {@link iconv()}. If omitted,
|
||||
* uses 'current locale'.
|
||||
* @param integer $lengthBytes (optional) Number of bytes that make up the
|
||||
* length. Default is 1.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringPascal($characterSet = '', $lengthBytes = 1)
|
||||
{
|
||||
$byteCount = $this->readUInt($lengthBytes);
|
||||
if ($byteCount == 0) {
|
||||
return '';
|
||||
}
|
||||
$bytes = $this->_dataSource->readBytes($byteCount);
|
||||
if ($characterSet == 'ASCII') {
|
||||
return $bytes;
|
||||
}
|
||||
return iconv('ASCII', $characterSet, $bytes);
|
||||
}
|
||||
|
||||
}
|
||||
217
modules/ruch/libraries/Zend/Pdf/FileParser/Font.php
Normal file
217
modules/ruch/libraries/Zend/Pdf/FileParser/Font.php
Normal file
@@ -0,0 +1,217 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Font.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Font.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser */
|
||||
require_once 'Zend/Pdf/FileParser.php';
|
||||
|
||||
/**
|
||||
* Abstract helper class for {@link Zend_Pdf_Font} that parses font files.
|
||||
*
|
||||
* Defines the public interface for concrete subclasses which are responsible
|
||||
* for parsing the raw binary data from the font file on disk. Also provides
|
||||
* a debug logging interface and a couple of shared utility methods.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* Array of parsed font properties. Used with {@link __get()} and
|
||||
* {@link __set()}.
|
||||
* @var array
|
||||
*/
|
||||
private $_fontProperties = array();
|
||||
|
||||
/**
|
||||
* Flag indicating whether or not debug logging is active.
|
||||
* @var boolean
|
||||
*/
|
||||
private $_debug = false;
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Object Lifecycle */
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
* Validates the data source and enables debug logging if so configured.
|
||||
*
|
||||
* @param Zend_Pdf_FileParserDataSource $dataSource
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct(Zend_Pdf_FileParserDataSource $dataSource)
|
||||
{
|
||||
parent::__construct($dataSource);
|
||||
$this->fontType = Zend_Pdf_Font::TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
/* Accessors */
|
||||
|
||||
/**
|
||||
* Get handler
|
||||
*
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($property)
|
||||
{
|
||||
if (isset($this->_fontProperties[$property])) {
|
||||
return $this->_fontProperties[$property];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/* NOTE: The set handler is defined below in the internal methods group. */
|
||||
|
||||
|
||||
/* Parser Methods */
|
||||
|
||||
/**
|
||||
* Reads the Unicode UTF-16-encoded string from the binary file at the
|
||||
* current offset location. Overridden to fix return character set at UTF-16BE.
|
||||
*
|
||||
* @todo Deal with to-dos in the parent method.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes (characters * 2) to return.
|
||||
* @param integer $byteOrder (optional) Big- or little-endian byte order.
|
||||
* Use the BYTE_ORDER_ constants defined in {@link Zend_Pdf_FileParser}. If
|
||||
* omitted, uses big-endian.
|
||||
* @param string $characterSet (optional) --Ignored--
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringUTF16($byteCount,
|
||||
$byteOrder = Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN,
|
||||
$characterSet = '')
|
||||
{
|
||||
return parent::readStringUTF16($byteCount, $byteOrder, 'UTF-16BE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Mac Roman-encoded string from the binary file at the current
|
||||
* offset location. Overridden to fix return character set at UTF-16BE.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes (characters) to return.
|
||||
* @param string $characterSet (optional) --Ignored--
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringMacRoman($byteCount, $characterSet = '')
|
||||
{
|
||||
return parent::readStringMacRoman($byteCount, 'UTF-16BE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the Pascal string from the binary file at the current offset
|
||||
* location. Overridden to fix return character set at UTF-16BE.
|
||||
*
|
||||
* @param string $characterSet (optional) --Ignored--
|
||||
* @param integer $lengthBytes (optional) Number of bytes that make up the
|
||||
* length. Default is 1.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readStringPascal($characterSet = '', $lengthBytes = 1)
|
||||
{
|
||||
return parent::readStringPascal('UTF-16BE');
|
||||
}
|
||||
|
||||
|
||||
/* Utility Methods */
|
||||
|
||||
/**
|
||||
* Writes the entire font properties array to STDOUT. Used only for debugging.
|
||||
*/
|
||||
public function writeDebug()
|
||||
{
|
||||
print_r($this->_fontProperties);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** Internal Methods ****/
|
||||
|
||||
|
||||
/* Internal Accessors */
|
||||
|
||||
/**
|
||||
* Set handler
|
||||
*
|
||||
* NOTE: This method is protected. Other classes may freely interrogate
|
||||
* the font properties, but only this and its subclasses may set them.
|
||||
*
|
||||
* @param string $property
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($property, $value)
|
||||
{
|
||||
if ($value === null) {
|
||||
unset($this->_fontProperties[$property]);
|
||||
} else {
|
||||
$this->_fontProperties[$property] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Internal Utility Methods */
|
||||
|
||||
/**
|
||||
* If debug logging is enabled, writes the log message.
|
||||
*
|
||||
* The log message is a sprintf() style string and any number of arguments
|
||||
* may accompany it as additional parameters.
|
||||
*
|
||||
* @param string $message
|
||||
* @param mixed (optional, multiple) Additional arguments
|
||||
*/
|
||||
protected function _debugLog($message)
|
||||
{
|
||||
if (! $this->_debug) {
|
||||
return;
|
||||
}
|
||||
if (func_num_args() > 1) {
|
||||
$args = func_get_args();
|
||||
$message = array_shift($args);
|
||||
$message = vsprintf($message, $args);
|
||||
}
|
||||
|
||||
require_once 'Zend/Log.php';
|
||||
$logger = new Zend_Log();
|
||||
$logger->log($message, Zend_Log::DEBUG);
|
||||
}
|
||||
}
|
||||
1126
modules/ruch/libraries/Zend/Pdf/FileParser/Font/OpenType.php
Normal file
1126
modules/ruch/libraries/Zend/Pdf/FileParser/Font/OpenType.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrueType.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
/**
|
||||
* Parses an OpenType font file containing TrueType outlines.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Verifies that the font file actually contains TrueType outlines.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function screen()
|
||||
{
|
||||
if ($this->_isScreened) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::screen();
|
||||
|
||||
switch ($this->_readScalerType()) {
|
||||
case 0x00010000: // version 1.0 - Windows TrueType signature
|
||||
break;
|
||||
|
||||
case 0x74727565: // 'true' - Macintosh TrueType signature
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not a TrueType font file',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
}
|
||||
|
||||
$this->fontType = Zend_Pdf_Font::TYPE_TRUETYPE;
|
||||
$this->_isScreened = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads and parses the TrueType font data from the file on disk.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
if ($this->_isParsed) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::parse();
|
||||
|
||||
/* There is nothing additional to parse for TrueType fonts at this time.
|
||||
*/
|
||||
|
||||
$this->_isParsed = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
63
modules/ruch/libraries/Zend/Pdf/FileParser/Image.php
Normal file
63
modules/ruch/libraries/Zend/Pdf/FileParser/Image.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Image.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
|
||||
/** Zend_Pdf_Image */
|
||||
require_once 'Zend/Pdf/Image.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser */
|
||||
require_once 'Zend/Pdf/FileParser.php';
|
||||
|
||||
/**
|
||||
* FileParser for Zend_Pdf_Image subclasses.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
*/
|
||||
protected $imageType;
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
* Validates the data source and enables debug logging if so configured.
|
||||
*
|
||||
* @param Zend_Pdf_FileParserDataSource $dataSource
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct(Zend_Pdf_FileParserDataSource $dataSource)
|
||||
{
|
||||
parent::__construct($dataSource);
|
||||
$this->imageType = Zend_Pdf_Image::TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
329
modules/ruch/libraries/Zend/Pdf/FileParser/Image/Png.php
Normal file
329
modules/ruch/libraries/Zend/Pdf/FileParser/Image/Png.php
Normal file
@@ -0,0 +1,329 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Png.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** @see Zend_Pdf_FileParser_Image */
|
||||
require_once 'Zend/Pdf/FileParser/Image.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for Image file parsers.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
protected $_isPNG;
|
||||
protected $_width;
|
||||
protected $_height;
|
||||
protected $_bits;
|
||||
protected $_color;
|
||||
protected $_compression;
|
||||
protected $_preFilter;
|
||||
protected $_interlacing;
|
||||
|
||||
protected $_imageData;
|
||||
protected $_paletteData;
|
||||
protected $_transparencyData;
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
public function getWidth() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
public function getHeight() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
public function getBitDepth() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_bits;
|
||||
}
|
||||
|
||||
public function getColorSpace() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_color;
|
||||
}
|
||||
|
||||
public function getCompressionStrategy() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_compression;
|
||||
}
|
||||
|
||||
public function getPaethFilter() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_preFilter;
|
||||
}
|
||||
|
||||
public function getInterlacingMode() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_interlacing;
|
||||
}
|
||||
|
||||
public function getRawImageData() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_imageData;
|
||||
}
|
||||
|
||||
public function getRawPaletteData() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_paletteData;
|
||||
}
|
||||
|
||||
public function getRawTransparencyData() {
|
||||
if(!$this->_isParsed) {
|
||||
$this->parse();
|
||||
}
|
||||
return $this->_transparencyData;
|
||||
}
|
||||
|
||||
/* Semi-Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Verifies that the image file is in the expected format.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function screen()
|
||||
{
|
||||
if ($this->_isScreened) {
|
||||
return;
|
||||
}
|
||||
return $this->_checkSignature();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads and parses the image data from the file on disk.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function parse()
|
||||
{
|
||||
if ($this->_isParsed) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Screen the font file first, if it hasn't been done yet.
|
||||
*/
|
||||
$this->screen();
|
||||
|
||||
$this->_parseIHDRChunk();
|
||||
$this->_parseChunks();
|
||||
}
|
||||
|
||||
|
||||
protected function _parseSignature() {
|
||||
$this->moveToOffset(1); //Skip the first byte (%)
|
||||
if('PNG' != $this->readBytes(3)) {
|
||||
$this->_isPNG = false;
|
||||
} else {
|
||||
$this->_isPNG = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _checkSignature() {
|
||||
if(!isset($this->_isPNG)) {
|
||||
$this->_parseSignature();
|
||||
}
|
||||
return $this->_isPNG;
|
||||
}
|
||||
|
||||
protected function _parseChunks() {
|
||||
$this->moveToOffset(33); //Variable chunks start at the end of IHDR
|
||||
|
||||
//Start processing chunks. If there are no more bytes to read parsing is complete.
|
||||
$size = $this->getSize();
|
||||
while($size - $this->getOffset() >= 8) {
|
||||
$chunkLength = $this->readUInt(4);
|
||||
if($chunkLength < 0 || ($chunkLength + $this->getOffset() + 4) > $size) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("PNG Corrupt: Invalid Chunk Size In File.");
|
||||
}
|
||||
|
||||
$chunkType = $this->readBytes(4);
|
||||
$offset = $this->getOffset();
|
||||
|
||||
//If we know how to process the chunk, do it here, else ignore the chunk and move on to the next
|
||||
switch($chunkType) {
|
||||
case 'IDAT': // This chunk may appear more than once. It contains the actual image data.
|
||||
$this->_parseIDATChunk($offset, $chunkLength);
|
||||
break;
|
||||
|
||||
case 'PLTE': // This chunk contains the image palette.
|
||||
$this->_parsePLTEChunk($offset, $chunkLength);
|
||||
break;
|
||||
|
||||
case 'tRNS': // This chunk contains non-alpha channel transparency data
|
||||
$this->_parseTRNSChunk($offset, $chunkLength);
|
||||
break;
|
||||
|
||||
case 'IEND':
|
||||
break 2; //End the loop too
|
||||
|
||||
//@TODO Implement the rest of the PNG chunks. (There are many not implemented here)
|
||||
}
|
||||
if($offset + $chunkLength + 4 < $size) {
|
||||
$this->moveToOffset($offset + $chunkLength + 4); //Skip past the data finalizer. (Don't rely on the parse to leave the offsets correct)
|
||||
}
|
||||
}
|
||||
if(empty($this->_imageData)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception ( "This PNG is corrupt. All png must contain IDAT chunks." );
|
||||
}
|
||||
}
|
||||
|
||||
protected function _parseIHDRChunk() {
|
||||
$this->moveToOffset(12); //IHDR must always start at offset 12 and run for 17 bytes
|
||||
if(!$this->readBytes(4) == 'IHDR') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception( "This PNG is corrupt. The first chunk in a PNG file must be IHDR." );
|
||||
}
|
||||
$this->_width = $this->readUInt(4);
|
||||
$this->_height = $this->readUInt(4);
|
||||
$this->_bits = $this->readInt(1);
|
||||
$this->_color = $this->readInt(1);
|
||||
$this->_compression = $this->readInt(1);
|
||||
$this->_preFilter = $this->readInt(1);
|
||||
$this->_interlacing = $this->readInt(1);
|
||||
if($this->_interlacing != Zend_Pdf_Image::PNG_INTERLACING_DISABLED) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception( "Only non-interlaced images are currently supported." );
|
||||
}
|
||||
}
|
||||
|
||||
protected function _parseIDATChunk($chunkOffset, $chunkLength) {
|
||||
$this->moveToOffset($chunkOffset);
|
||||
if(!isset($this->_imageData)) {
|
||||
$this->_imageData = $this->readBytes($chunkLength);
|
||||
} else {
|
||||
$this->_imageData .= $this->readBytes($chunkLength);
|
||||
}
|
||||
}
|
||||
|
||||
protected function _parsePLTEChunk($chunkOffset, $chunkLength) {
|
||||
$this->moveToOffset($chunkOffset);
|
||||
$this->_paletteData = $this->readBytes($chunkLength);
|
||||
}
|
||||
|
||||
protected function _parseTRNSChunk($chunkOffset, $chunkLength) {
|
||||
$this->moveToOffset($chunkOffset);
|
||||
|
||||
//Processing of tRNS data varies dependending on the color depth
|
||||
|
||||
switch($this->_color) {
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_GRAY:
|
||||
$baseColor = $this->readInt(1);
|
||||
$this->_transparencyData = array($baseColor, $baseColor);
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_RGB:
|
||||
|
||||
//@TODO Fix this hack.
|
||||
//This parser cheats and only uses the lsb's (and only works with < 16 bit depth images)
|
||||
|
||||
/*
|
||||
From the standard:
|
||||
|
||||
For color type 2 (truecolor), the tRNS chunk contains a single RGB color value, stored in the format:
|
||||
|
||||
Red: 2 bytes, range 0 .. (2^bitdepth)-1
|
||||
Green: 2 bytes, range 0 .. (2^bitdepth)-1
|
||||
Blue: 2 bytes, range 0 .. (2^bitdepth)-1
|
||||
|
||||
(If the image bit depth is less than 16, the least significant bits are used and the others are 0.)
|
||||
Pixels of the specified color value are to be treated as transparent (equivalent to alpha value 0);
|
||||
all other pixels are to be treated as fully opaque (alpha value 2bitdepth-1).
|
||||
|
||||
*/
|
||||
|
||||
$red = $this->readInt(1);
|
||||
$this->skipBytes(1);
|
||||
$green = $this->readInt(1);
|
||||
$this->skipBytes(1);
|
||||
$blue = $this->readInt(1);
|
||||
|
||||
$this->_transparencyData = array($red, $red, $green, $green, $blue, $blue);
|
||||
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_INDEXED:
|
||||
|
||||
//@TODO Fix this hack.
|
||||
//This parser cheats too. It only masks the first color in the palette.
|
||||
|
||||
/*
|
||||
From the standard:
|
||||
|
||||
For color type 3 (indexed color), the tRNS chunk contains a series of one-byte alpha values, corresponding to entries in the PLTE chunk:
|
||||
|
||||
Alpha for palette index 0: 1 byte
|
||||
Alpha for palette index 1: 1 byte
|
||||
...etc...
|
||||
|
||||
Each entry indicates that pixels of the corresponding palette index must be treated as having the specified alpha value.
|
||||
Alpha values have the same interpretation as in an 8-bit full alpha channel: 0 is fully transparent, 255 is fully opaque,
|
||||
regardless of image bit depth. The tRNS chunk must not contain more alpha values than there are palette entries,
|
||||
but tRNS can contain fewer values than there are palette entries. In this case, the alpha value for all remaining palette
|
||||
entries is assumed to be 255. In the common case in which only palette index 0 need be made transparent, only a one-byte
|
||||
tRNS chunk is needed.
|
||||
|
||||
*/
|
||||
|
||||
$tmpData = $this->readBytes($chunkLength);
|
||||
if(($trnsIdx = strpos($tmpData, "\0")) !== false) {
|
||||
$this->_transparencyData = array($trnsIdx, $trnsIdx);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_GRAY_ALPHA:
|
||||
//Fall through to the next case
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_RGB_ALPHA:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception( "tRNS chunk illegal for Alpha Channel Images" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
9
modules/ruch/libraries/Zend/Pdf/FileParser/index.php
Normal file
9
modules/ruch/libraries/Zend/Pdf/FileParser/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
204
modules/ruch/libraries/Zend/Pdf/FileParserDataSource.php
Normal file
204
modules/ruch/libraries/Zend/Pdf/FileParserDataSource.php
Normal file
@@ -0,0 +1,204 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FileParserDataSource.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract helper class for {@link Zend_Pdf_FileParser} that provides the
|
||||
* data source for parsing.
|
||||
*
|
||||
* Concrete subclasses allow for parsing of in-memory, filesystem, and other
|
||||
* sources through a common API. These subclasses also take care of error
|
||||
* handling and other mundane tasks.
|
||||
*
|
||||
* Subclasses must implement at minimum {@link __construct()},
|
||||
* {@link __destruct()}, {@link readBytes()}, and {@link readAllBytes()}.
|
||||
* Subclasses should also override {@link moveToOffset()} and
|
||||
* {@link __toString()} as appropriate.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Pdf_FileParserDataSource
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* Total size in bytes of the data source.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_size = 0;
|
||||
|
||||
/**
|
||||
* Byte offset of the current read position within the data source.
|
||||
* @var integer
|
||||
*/
|
||||
protected $_offset = 0;
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Abstract Methods */
|
||||
|
||||
/**
|
||||
* Object constructor. Opens the data source for parsing.
|
||||
*
|
||||
* Must set $this->_size to the total size in bytes of the data source.
|
||||
*
|
||||
* Upon return the data source can be interrogated using the primitive
|
||||
* methods described here.
|
||||
*
|
||||
* If the data source cannot be opened for any reason (such as insufficient
|
||||
* permissions, missing file, etc.), will throw an appropriate exception.
|
||||
*
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
abstract public function __construct();
|
||||
|
||||
/**
|
||||
* Object destructor. Closes the data source.
|
||||
*
|
||||
* May also perform cleanup tasks such as deleting temporary files.
|
||||
*/
|
||||
abstract public function __destruct();
|
||||
|
||||
/**
|
||||
* Returns the specified number of raw bytes from the data source at the
|
||||
* byte offset of the current read position.
|
||||
*
|
||||
* Must advance the read position by the number of bytes read by updating
|
||||
* $this->_offset.
|
||||
*
|
||||
* Throws an exception if there is insufficient data to completely fulfill
|
||||
* the request or if an error occurs.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to read.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
abstract public function readBytes($byteCount);
|
||||
|
||||
/**
|
||||
* Returns the entire contents of the data source as a string.
|
||||
*
|
||||
* This method may be called at any time and so must preserve the byte
|
||||
* offset of the read position, both through $this->_offset and whatever
|
||||
* other additional pointers (such as the seek position of a file pointer)
|
||||
* that might be used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function readAllBytes();
|
||||
|
||||
|
||||
/* Object Magic Methods */
|
||||
|
||||
/**
|
||||
* Returns a description of the object for debugging purposes.
|
||||
*
|
||||
* Subclasses should override this method to provide a more specific
|
||||
* description of the actual object being represented.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return get_class($this);
|
||||
}
|
||||
|
||||
|
||||
/* Accessors */
|
||||
|
||||
/**
|
||||
* Returns the byte offset of the current read position within the data
|
||||
* source.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getOffset()
|
||||
{
|
||||
return $this->_offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the total size in bytes of the data source.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getSize()
|
||||
{
|
||||
return $this->_size;
|
||||
}
|
||||
|
||||
|
||||
/* Primitive Methods */
|
||||
|
||||
/**
|
||||
* Moves the current read position to the specified byte offset.
|
||||
*
|
||||
* Throws an exception you attempt to move before the beginning or beyond
|
||||
* the end of the data source.
|
||||
*
|
||||
* If a subclass needs to perform additional tasks (such as performing a
|
||||
* fseek() on a filesystem source), it should do so after calling this
|
||||
* parent method.
|
||||
*
|
||||
* @param integer $offset Destination byte offset.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function moveToOffset($offset)
|
||||
{
|
||||
if ($this->_offset == $offset) {
|
||||
return; // Not moving; do nothing.
|
||||
}
|
||||
if ($offset < 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Attempt to move before start of data source',
|
||||
Zend_Pdf_Exception::MOVE_BEFORE_START_OF_FILE);
|
||||
}
|
||||
if ($offset >= $this->_size) { // Offsets are zero-based.
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Attempt to move beyond end of data source',
|
||||
Zend_Pdf_Exception::MOVE_BEYOND_END_OF_FILE);
|
||||
}
|
||||
$this->_offset = $offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shifts the current read position within the data source by the specified
|
||||
* number of bytes.
|
||||
*
|
||||
* You may move forward (positive numbers) or backward (negative numbers).
|
||||
* Throws an exception you attempt to move before the beginning or beyond
|
||||
* the end of the data source.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to skip.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function skipBytes($byteCount)
|
||||
{
|
||||
$this->moveToOffset($this->_offset + $byteCount);
|
||||
}
|
||||
}
|
||||
198
modules/ruch/libraries/Zend/Pdf/FileParserDataSource/File.php
Normal file
198
modules/ruch/libraries/Zend/Pdf/FileParserDataSource/File.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: File.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
|
||||
/**
|
||||
* Concrete subclass of {@link Zend_Pdf_FileParserDataSource} that provides an
|
||||
* interface to filesystem objects.
|
||||
*
|
||||
* Note that this class cannot be used for other sources that may be supported
|
||||
* by {@link fopen()} (through URL wrappers). It may be used for local
|
||||
* filesystem objects only.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* Fully-qualified path to the file.
|
||||
* @var string
|
||||
*/
|
||||
protected $_filePath = '';
|
||||
|
||||
/**
|
||||
* File resource handle .
|
||||
* @var resource
|
||||
*/
|
||||
protected $_fileResource = null;
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
* Validates the path to the file, ensures that it is readable, then opens
|
||||
* it for reading.
|
||||
*
|
||||
* Throws an exception if the file is missing or cannot be opened.
|
||||
*
|
||||
* @param string $filePath Fully-qualified path to the file.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function __construct($filePath)
|
||||
{
|
||||
if (! (is_file($filePath) || is_link($filePath))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Invalid file path: $filePath",
|
||||
Zend_Pdf_Exception::BAD_FILE_PATH);
|
||||
}
|
||||
if (! is_readable($filePath)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("File is not readable: $filePath",
|
||||
Zend_Pdf_Exception::NOT_READABLE);
|
||||
}
|
||||
if (($this->_size = @filesize($filePath)) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Error while obtaining file size: $filePath",
|
||||
Zend_Pdf_Exception::CANT_GET_FILE_SIZE);
|
||||
}
|
||||
if (($this->_fileResource = @fopen($filePath, 'rb')) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot open file for reading: $filePath",
|
||||
Zend_Pdf_Exception::CANT_OPEN_FILE);
|
||||
}
|
||||
$this->_filePath = $filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object destructor.
|
||||
*
|
||||
* Closes the file if it had been successfully opened.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (is_resource($this->_fileResource)) {
|
||||
@fclose($this->_fileResource);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specified number of raw bytes from the file at the byte
|
||||
* offset of the current read position.
|
||||
*
|
||||
* Advances the read position by the number of bytes read.
|
||||
*
|
||||
* Throws an exception if an error was encountered while reading the file or
|
||||
* if there is insufficient data to completely fulfill the request.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to read.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readBytes($byteCount)
|
||||
{
|
||||
$bytes = @fread($this->_fileResource, $byteCount);
|
||||
if ($bytes === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unexpected error while reading file',
|
||||
Zend_Pdf_Exception::ERROR_DURING_READ);
|
||||
}
|
||||
if (strlen($bytes) != $byteCount) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Insufficient data to read $byteCount bytes",
|
||||
Zend_Pdf_Exception::INSUFFICIENT_DATA);
|
||||
}
|
||||
$this->_offset += $byteCount;
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entire contents of the file as a string.
|
||||
*
|
||||
* Preserves the current file seek position.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function readAllBytes()
|
||||
{
|
||||
return file_get_contents($this->_filePath);
|
||||
}
|
||||
|
||||
|
||||
/* Object Magic Methods */
|
||||
|
||||
/**
|
||||
* Returns the full filesystem path of the file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_filePath;
|
||||
}
|
||||
|
||||
|
||||
/* Primitive Methods */
|
||||
|
||||
/**
|
||||
* Seeks the file read position to the specified byte offset.
|
||||
*
|
||||
* Throws an exception if the file pointer cannot be moved or if it is
|
||||
* moved beyond EOF (end of file).
|
||||
*
|
||||
* @param integer $offset Destination byte offset.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function moveToOffset($offset)
|
||||
{
|
||||
if ($this->_offset == $offset) {
|
||||
return; // Not moving; do nothing.
|
||||
}
|
||||
parent::moveToOffset($offset);
|
||||
$result = @fseek($this->_fileResource, $offset, SEEK_SET);
|
||||
if ($result !== 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Error while setting new file position',
|
||||
Zend_Pdf_Exception::CANT_SET_FILE_POSITION);
|
||||
}
|
||||
if (feof($this->_fileResource)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Moved beyond the end of the file',
|
||||
Zend_Pdf_Exception::MOVE_BEYOND_END_OF_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
128
modules/ruch/libraries/Zend/Pdf/FileParserDataSource/String.php
Normal file
128
modules/ruch/libraries/Zend/Pdf/FileParserDataSource/String.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?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 FileParser
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: String.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
/**
|
||||
* Concrete subclass of {@link Zend_Pdf_FileParserDataSource} that provides an
|
||||
* interface to binary strings.
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**** Instance Variables ****/
|
||||
|
||||
|
||||
/**
|
||||
* The string to parse.
|
||||
* @var string
|
||||
*/
|
||||
protected $_string = '';
|
||||
|
||||
|
||||
|
||||
/**** Public Interface ****/
|
||||
|
||||
|
||||
/* Concrete Class Implementation */
|
||||
|
||||
/**
|
||||
* Object constructor.
|
||||
*
|
||||
* Verifies that the string is not empty.
|
||||
*
|
||||
* @param string $string String to parse.
|
||||
*/
|
||||
public function __construct($string)
|
||||
{
|
||||
if (empty($string)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('String is empty',
|
||||
Zend_Pdf_Exception::PARAMETER_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
$this->_size = strlen($string);
|
||||
$this->_string = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object destructor.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->_string = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the specified number of raw bytes from the string at the byte
|
||||
* offset of the current read position.
|
||||
*
|
||||
* Advances the read position by the number of bytes read.
|
||||
*
|
||||
* Throws an exception if there is insufficient data to completely fulfill
|
||||
* the request.
|
||||
*
|
||||
* @param integer $byteCount Number of bytes to read.
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function readBytes($byteCount)
|
||||
{
|
||||
if (($this->_offset + $byteCount) > $this->_size) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Insufficient data to read $byteCount bytes",
|
||||
Zend_Pdf_Exception::INSUFFICIENT_DATA);
|
||||
}
|
||||
$bytes = substr($this->_string, $this->_offset, $byteCount);
|
||||
$this->_offset += $byteCount;
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entire string.
|
||||
*
|
||||
* Preserves the current read position.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function readAllBytes()
|
||||
{
|
||||
return $this->_string;
|
||||
}
|
||||
|
||||
|
||||
/* Object Magic Methods */
|
||||
|
||||
/**
|
||||
* Returns a string containing the parsed string's length.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return "String ($this->_size bytes)";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
||||
181
modules/ruch/libraries/Zend/Pdf/Filter/Ascii85.php
Normal file
181
modules/ruch/libraries/Zend/Pdf/Filter/Ascii85.php
Normal file
@@ -0,0 +1,181 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ascii85.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
/**
|
||||
* ASCII85 stream filter
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Encode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function encode($data, $params = null)
|
||||
{
|
||||
$output = '';
|
||||
$dataLength = strlen($data);
|
||||
|
||||
for ($i = 0; $i < $dataLength; $i += 4) {
|
||||
//convert the 4 characters into a 32-bit number
|
||||
$chunk = substr($data, $i, 4);
|
||||
|
||||
if (strlen($chunk) < 4) {
|
||||
//partial chunk
|
||||
break;
|
||||
}
|
||||
|
||||
$b = unpack("N", $chunk);
|
||||
$b = $b[1];
|
||||
|
||||
//special char for all 4 bytes = 0
|
||||
if ($b == 0) {
|
||||
$output .= 'z';
|
||||
continue;
|
||||
}
|
||||
|
||||
//encode into 5 bytes
|
||||
for ($j = 4; $j >= 0; $j--) {
|
||||
$foo = (int) (($b / pow(85,$j)) + 33);
|
||||
$b %= pow(85,$j);
|
||||
$output .= chr($foo);
|
||||
}
|
||||
}
|
||||
|
||||
//encode partial chunk
|
||||
if ($i < $dataLength) {
|
||||
$n = $dataLength - $i;
|
||||
$chunk = substr($data, -$n);
|
||||
|
||||
//0 pad the rest
|
||||
for ($j = $n;$j < 4;$j++) {
|
||||
$chunk .= "\0";
|
||||
}
|
||||
|
||||
$b = unpack("N", $chunk);
|
||||
$b = $b[1];
|
||||
|
||||
//encode just $n + 1
|
||||
for ($j = 4; $j >= (4 - $n); $j--) {
|
||||
$foo = (int) (($b / pow(85,$j)) + 33);
|
||||
$b %= pow(85,$j);
|
||||
$output .= chr($foo);
|
||||
}
|
||||
}
|
||||
|
||||
//EOD
|
||||
$output .= '~>';
|
||||
|
||||
//make sure lines are split
|
||||
$output = chunk_split($output, 76, "\n");
|
||||
|
||||
//get rid of new line at the end
|
||||
$output = substr($output, 0, -1);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
$output = '';
|
||||
|
||||
//get rid of the whitespaces
|
||||
$whiteSpace = array("\x00", "\x09", "\x0A", "\x0C", "\x0D", "\x20");
|
||||
$data = str_replace($whiteSpace, '', $data);
|
||||
|
||||
if (substr($data, -2) != '~>') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid EOF marker');
|
||||
return '';
|
||||
}
|
||||
|
||||
$data = substr($data, 0, (strlen($data) - 2));
|
||||
$dataLength = strlen($data);
|
||||
|
||||
for ($i = 0; $i < $dataLength; $i += 5) {
|
||||
$b = 0;
|
||||
|
||||
if (substr($data, $i, 1) == "z") {
|
||||
$i -= 4;
|
||||
$output .= pack("N", 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
$c = substr($data, $i, 5);
|
||||
|
||||
if(strlen($c) < 5) {
|
||||
//partial chunk
|
||||
break;
|
||||
}
|
||||
|
||||
$c = unpack('C5', $c);
|
||||
$value = 0;
|
||||
|
||||
for ($j = 1; $j <= 5; $j++) {
|
||||
$value += (($c[$j] - 33) * pow(85, (5 - $j)));
|
||||
}
|
||||
|
||||
$output .= pack("N", $value);
|
||||
}
|
||||
|
||||
//decode partial
|
||||
if ($i < $dataLength) {
|
||||
$value = 0;
|
||||
$chunk = substr($data, $i);
|
||||
$partialLength = strlen($chunk);
|
||||
|
||||
//pad the rest of the chunk with u's
|
||||
//until the lenght of the chunk is 5
|
||||
for ($j = 0; $j < (5 - $partialLength); $j++) {
|
||||
$chunk .= 'u';
|
||||
}
|
||||
|
||||
$c = unpack('C5', $chunk);
|
||||
|
||||
for ($j = 1; $j <= 5; $j++) {
|
||||
$value += (($c[$j] - 33) * pow(85, (5 - $j)));
|
||||
}
|
||||
|
||||
$foo = pack("N", $value);
|
||||
$output .= substr($foo, 0, ($partialLength - 1));
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
135
modules/ruch/libraries/Zend/Pdf/Filter/AsciiHex.php
Normal file
135
modules/ruch/libraries/Zend/Pdf/Filter/AsciiHex.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AsciiHex.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
/**
|
||||
* AsciiHex stream filter
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Encode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function encode($data, $params = null)
|
||||
{
|
||||
return bin2hex($data) . '>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
$output = '';
|
||||
$oddCode = true;
|
||||
$commentMode = false;
|
||||
|
||||
for ($count = 0; $count < strlen($data) && $data[$count] != '>'; $count++) {
|
||||
$charCode = ord($data[$count]);
|
||||
|
||||
if ($commentMode) {
|
||||
if ($charCode == 0x0A || $charCode == 0x0D ) {
|
||||
$commentMode = false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($charCode) {
|
||||
//Skip white space
|
||||
case 0x00: // null character
|
||||
// fall through to next case
|
||||
case 0x09: // Tab
|
||||
// fall through to next case
|
||||
case 0x0A: // Line feed
|
||||
// fall through to next case
|
||||
case 0x0C: // Form Feed
|
||||
// fall through to next case
|
||||
case 0x0D: // Carriage return
|
||||
// fall through to next case
|
||||
case 0x20: // Space
|
||||
// Do nothing
|
||||
break;
|
||||
|
||||
case 0x25: // '%'
|
||||
// Switch to comment mode
|
||||
$commentMode = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if ($charCode >= 0x30 /*'0'*/ && $charCode <= 0x39 /*'9'*/) {
|
||||
$code = $charCode - 0x30;
|
||||
} else if ($charCode >= 0x41 /*'A'*/ && $charCode <= 0x46 /*'F'*/) {
|
||||
$code = $charCode - 0x37/*0x41 - 0x0A*/;
|
||||
} else if ($charCode >= 0x61 /*'a'*/ && $charCode <= 0x66 /*'f'*/) {
|
||||
$code = $charCode - 0x57/*0x61 - 0x0A*/;
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong character in a encoded stream');
|
||||
}
|
||||
|
||||
if ($oddCode) {
|
||||
// Odd pass. Store hex digit for next pass
|
||||
// Scope of $hexCodeHigh variable is whole function
|
||||
$hexCodeHigh = $code;
|
||||
} else {
|
||||
// Even pass.
|
||||
// Add decoded character to the output
|
||||
// ($hexCodeHigh is stored in previous pass)
|
||||
$output .= chr($hexCodeHigh*16 + $code);
|
||||
}
|
||||
$oddCode = !$oddCode;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check that stream is terminated by End Of Data marker */
|
||||
if ($data[$count] != '>') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong encoded stream End Of Data marker.');
|
||||
}
|
||||
|
||||
/* Last '0' character is omitted */
|
||||
if (!$oddCode) {
|
||||
$output .= chr($hexCodeHigh*16);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
391
modules/ruch/libraries/Zend/Pdf/Filter/Compression.php
Normal file
391
modules/ruch/libraries/Zend/Pdf/Filter/Compression.php
Normal file
@@ -0,0 +1,391 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Compression.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
/**
|
||||
* ASCII85 stream filter
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Paeth prediction function
|
||||
*
|
||||
* @param integer $a
|
||||
* @param integer $b
|
||||
* @param integer $c
|
||||
* @return integer
|
||||
*/
|
||||
private static function _paeth($a, $b, $c)
|
||||
{
|
||||
// $a - left, $b - above, $c - upper left
|
||||
$p = $a + $b - $c; // initial estimate
|
||||
$pa = abs($p - $a); // distances to a, b, c
|
||||
$pb = abs($p - $b);
|
||||
$pc = abs($p - $c);
|
||||
|
||||
// return nearest of a,b,c,
|
||||
// breaking ties in order a,b,c.
|
||||
if ($pa <= $pb && $pa <= $pc) {
|
||||
return $a;
|
||||
} else if ($pb <= $pc) {
|
||||
return $b;
|
||||
} else {
|
||||
return $c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Predictor decode param value
|
||||
*
|
||||
* @param array $params
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private static function _getPredictorValue(&$params)
|
||||
{
|
||||
if (isset($params['Predictor'])) {
|
||||
$predictor = $params['Predictor'];
|
||||
|
||||
if ($predictor != 1 && $predictor != 2 &&
|
||||
$predictor != 10 && $predictor != 11 && $predictor != 12 &&
|
||||
$predictor != 13 && $predictor != 14 && $predictor != 15) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid value of \'Predictor\' decode param - ' . $predictor . '.' );
|
||||
}
|
||||
return $predictor;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Colors decode param value
|
||||
*
|
||||
* @param array $params
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private static function _getColorsValue(&$params)
|
||||
{
|
||||
if (isset($params['Colors'])) {
|
||||
$colors = $params['Colors'];
|
||||
|
||||
if ($colors != 1 && $colors != 2 && $colors != 3 && $colors != 4) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid value of \'Color\' decode param - ' . $colors . '.' );
|
||||
}
|
||||
return $colors;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get BitsPerComponent decode param value
|
||||
*
|
||||
* @param array $params
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private static function _getBitsPerComponentValue(&$params)
|
||||
{
|
||||
if (isset($params['BitsPerComponent'])) {
|
||||
$bitsPerComponent = $params['BitsPerComponent'];
|
||||
|
||||
if ($bitsPerComponent != 1 && $bitsPerComponent != 2 &&
|
||||
$bitsPerComponent != 4 && $bitsPerComponent != 8 &&
|
||||
$bitsPerComponent != 16 ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid value of \'BitsPerComponent\' decode param - ' . $bitsPerComponent . '.' );
|
||||
}
|
||||
return $bitsPerComponent;
|
||||
} else {
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Columns decode param value
|
||||
*
|
||||
* @param array $params
|
||||
* @return integer
|
||||
*/
|
||||
private static function _getColumnsValue(&$params)
|
||||
{
|
||||
if (isset($params['Columns'])) {
|
||||
return $params['Columns'];
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert stream data according to the filter params set before encoding.
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected static function _applyEncodeParams($data, $params) {
|
||||
$predictor = self::_getPredictorValue($params);
|
||||
$colors = self::_getColorsValue($params);
|
||||
$bitsPerComponent = self::_getBitsPerComponentValue($params);
|
||||
$columns = self::_getColumnsValue($params);
|
||||
|
||||
/** None of prediction */
|
||||
if ($predictor == 1) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** TIFF Predictor 2 */
|
||||
if ($predictor == 2) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet' );
|
||||
}
|
||||
|
||||
/** Optimal PNG prediction */
|
||||
if ($predictor == 15) {
|
||||
/** Use Paeth prediction as optimal */
|
||||
$predictor = 14;
|
||||
}
|
||||
|
||||
/** PNG prediction */
|
||||
if ($predictor == 10 || /** None of prediction */
|
||||
$predictor == 11 || /** Sub prediction */
|
||||
$predictor == 12 || /** Up prediction */
|
||||
$predictor == 13 || /** Average prediction */
|
||||
$predictor == 14 /** Paeth prediction */
|
||||
) {
|
||||
$predictor -= 10;
|
||||
|
||||
if($bitsPerComponent == 16) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("PNG Prediction with bit depth greater than 8 not yet supported.");
|
||||
}
|
||||
|
||||
$bitsPerSample = $bitsPerComponent*$colors;
|
||||
$bytesPerSample = (int)(($bitsPerSample + 7)/8); // (int)ceil(...) emulation
|
||||
$bytesPerRow = (int)(($bitsPerSample*$columns + 7)/8); // (int)ceil(...) emulation
|
||||
$rows = strlen($data)/$bytesPerRow;
|
||||
$output = '';
|
||||
$offset = 0;
|
||||
|
||||
if (!is_integer($rows)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong data length.');
|
||||
}
|
||||
|
||||
switch ($predictor) {
|
||||
case 0: // None of prediction
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$output .= chr($predictor);
|
||||
$output .= substr($data, $offset, $bytesPerRow);
|
||||
$offset += $bytesPerRow;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Sub prediction
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$output .= chr($predictor);
|
||||
|
||||
$lastSample = array_fill(0, $bytesPerSample, 0);
|
||||
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
|
||||
$newByte = ord($data[$offset++]);
|
||||
// Note. chr() automatically cuts input to 8 bit
|
||||
$output .= chr($newByte - $lastSample[$count2 % $bytesPerSample]);
|
||||
$lastSample[$count2 % $bytesPerSample] = $newByte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // Up prediction
|
||||
$lastRow = array_fill(0, $bytesPerRow, 0);
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$output .= chr($predictor);
|
||||
|
||||
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
|
||||
$newByte = ord($data[$offset++]);
|
||||
// Note. chr() automatically cuts input to 8 bit
|
||||
$output .= chr($newByte - $lastRow[$count2]);
|
||||
$lastRow[$count2] = $newByte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // Average prediction
|
||||
$lastRow = array_fill(0, $bytesPerRow, 0);
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$output .= chr($predictor);
|
||||
|
||||
$lastSample = array_fill(0, $bytesPerSample, 0);
|
||||
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
|
||||
$newByte = ord($data[$offset++]);
|
||||
// Note. chr() automatically cuts input to 8 bit
|
||||
$output .= chr($newByte - floor(( $lastSample[$count2 % $bytesPerSample] + $lastRow[$count2])/2));
|
||||
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $newByte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // Paeth prediction
|
||||
$lastRow = array_fill(0, $bytesPerRow, 0);
|
||||
$currentRow = array();
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$output .= chr($predictor);
|
||||
|
||||
$lastSample = array_fill(0, $bytesPerSample, 0);
|
||||
for ($count2 = 0; $count2 < $bytesPerRow; $count2++) {
|
||||
$newByte = ord($data[$offset++]);
|
||||
// Note. chr() automatically cuts input to 8 bit
|
||||
$output .= chr($newByte - self::_paeth( $lastSample[$count2 % $bytesPerSample],
|
||||
$lastRow[$count2],
|
||||
($count2 - $bytesPerSample < 0)?
|
||||
0 : $lastRow[$count2 - $bytesPerSample] ));
|
||||
$lastSample[$count2 % $bytesPerSample] = $currentRow[$count2] = $newByte;
|
||||
}
|
||||
$lastRow = $currentRow;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown prediction algorithm - ' . $predictor . '.' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert stream data according to the filter params set after decoding.
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
*/
|
||||
protected static function _applyDecodeParams($data, $params) {
|
||||
$predictor = self::_getPredictorValue($params);
|
||||
$colors = self::_getColorsValue($params);
|
||||
$bitsPerComponent = self::_getBitsPerComponentValue($params);
|
||||
$columns = self::_getColumnsValue($params);
|
||||
|
||||
/** None of prediction */
|
||||
if ($predictor == 1) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** TIFF Predictor 2 */
|
||||
if ($predictor == 2) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet' );
|
||||
}
|
||||
|
||||
/**
|
||||
* PNG prediction
|
||||
* Prediction code is duplicated on each row.
|
||||
* Thus all cases can be brought to one
|
||||
*/
|
||||
if ($predictor == 10 || /** None of prediction */
|
||||
$predictor == 11 || /** Sub prediction */
|
||||
$predictor == 12 || /** Up prediction */
|
||||
$predictor == 13 || /** Average prediction */
|
||||
$predictor == 14 || /** Paeth prediction */
|
||||
$predictor == 15 /** Optimal prediction */) {
|
||||
|
||||
$bitsPerSample = $bitsPerComponent*$colors;
|
||||
$bytesPerSample = ceil($bitsPerSample/8);
|
||||
$bytesPerRow = ceil($bitsPerSample*$columns/8);
|
||||
$rows = ceil(strlen($data)/($bytesPerRow + 1));
|
||||
$output = '';
|
||||
$offset = 0;
|
||||
|
||||
$lastRow = array_fill(0, $bytesPerRow, 0);
|
||||
for ($count = 0; $count < $rows; $count++) {
|
||||
$lastSample = array_fill(0, $bytesPerSample, 0);
|
||||
switch (ord($data[$offset++])) {
|
||||
case 0: // None of prediction
|
||||
$output .= substr($data, $offset, $bytesPerRow);
|
||||
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
|
||||
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = ord($data[$offset++]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Sub prediction
|
||||
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
|
||||
$decodedByte = (ord($data[$offset++]) + $lastSample[$count2 % $bytesPerSample]) & 0xFF;
|
||||
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
|
||||
$output .= chr($decodedByte);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // Up prediction
|
||||
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
|
||||
$decodedByte = (ord($data[$offset++]) + $lastRow[$count2]) & 0xFF;
|
||||
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
|
||||
$output .= chr($decodedByte);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // Average prediction
|
||||
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
|
||||
$decodedByte = (ord($data[$offset++]) +
|
||||
floor(( $lastSample[$count2 % $bytesPerSample] + $lastRow[$count2])/2)
|
||||
) & 0xFF;
|
||||
$lastSample[$count2 % $bytesPerSample] = $lastRow[$count2] = $decodedByte;
|
||||
$output .= chr($decodedByte);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // Paeth prediction
|
||||
$currentRow = array();
|
||||
for ($count2 = 0; $count2 < $bytesPerRow && $offset < strlen($data); $count2++) {
|
||||
$decodedByte = (ord($data[$offset++]) +
|
||||
self::_paeth($lastSample[$count2 % $bytesPerSample],
|
||||
$lastRow[$count2],
|
||||
($count2 - $bytesPerSample < 0)?
|
||||
0 : $lastRow[$count2 - $bytesPerSample])
|
||||
) & 0xFF;
|
||||
$lastSample[$count2 % $bytesPerSample] = $currentRow[$count2] = $decodedByte;
|
||||
$output .= chr($decodedByte);
|
||||
}
|
||||
$lastRow = $currentRow;
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown prediction tag.');
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown prediction algorithm - ' . $predictor . '.' );
|
||||
}
|
||||
}
|
||||
102
modules/ruch/libraries/Zend/Pdf/Filter/Compression/Flate.php
Normal file
102
modules/ruch/libraries/Zend/Pdf/Filter/Compression/Flate.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Flate.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Compression */
|
||||
require_once 'Zend/Pdf/Filter/Compression.php';
|
||||
|
||||
/**
|
||||
* Flate stream filter
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Encode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function encode($data, $params = null)
|
||||
{
|
||||
if ($params != null) {
|
||||
$data = self::_applyEncodeParams($data, $params);
|
||||
}
|
||||
|
||||
if (extension_loaded('zlib')) {
|
||||
$trackErrors = ini_get( "track_errors");
|
||||
ini_set('track_errors', '1');
|
||||
|
||||
if (($output = @gzcompress($data)) === false) {
|
||||
ini_set('track_errors', $trackErrors);
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception($php_errormsg);
|
||||
}
|
||||
|
||||
ini_set('track_errors', $trackErrors);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet. You have to use zlib extension.');
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
global $php_errormsg;
|
||||
|
||||
if (extension_loaded('zlib')) {
|
||||
$trackErrors = ini_get( "track_errors");
|
||||
ini_set('track_errors', '1');
|
||||
|
||||
if (($output = @gzuncompress($data)) === false) {
|
||||
ini_set('track_errors', $trackErrors);
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception($php_errormsg);
|
||||
}
|
||||
|
||||
ini_set('track_errors', $trackErrors);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
}
|
||||
|
||||
if ($params !== null) {
|
||||
return self::_applyDecodeParams($output, $params);
|
||||
} else {
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
95
modules/ruch/libraries/Zend/Pdf/Filter/Compression/Lzw.php
Normal file
95
modules/ruch/libraries/Zend/Pdf/Filter/Compression/Lzw.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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
|
||||
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Lzw.php 23775 2011-03-01 17:25:24Z ralph $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Compression */
|
||||
require_once 'Zend/Pdf/Filter/Compression.php';
|
||||
|
||||
/**
|
||||
* LZW stream filter
|
||||
*
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2011 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
|
||||
{
|
||||
/**
|
||||
* Get EarlyChange decode param value
|
||||
*
|
||||
* @param array $params
|
||||
* @return integer
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
private static function _getEarlyChangeValue($params)
|
||||
{
|
||||
if (isset($params['EarlyChange'])) {
|
||||
$earlyChange = $params['EarlyChange'];
|
||||
|
||||
if ($earlyChange != 0 && $earlyChange != 1) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Invalid value of \'EarlyChange\' decode param - ' . $earlyChange . '.' );
|
||||
}
|
||||
return $earlyChange;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function encode($data, $params = null)
|
||||
{
|
||||
if ($params != null) {
|
||||
$data = self::_applyEncodeParams($data, $params);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode data
|
||||
*
|
||||
* @param string $data
|
||||
* @param array $params
|
||||
* @return string
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
|
||||
if ($params !== null) {
|
||||
return self::_applyDecodeParams($data, $params);
|
||||
} else {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user