import v2.0.0.0_RC3 | 2012-07-01
https://github.com/lucanos/CommunityID -> http://www.itadmins.net/archives/357
This commit is contained in:
@ -17,11 +17,14 @@
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Action.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Action.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** 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';
|
||||
@ -68,6 +71,7 @@ abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveItera
|
||||
*/
|
||||
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.');
|
||||
@ -114,6 +118,7 @@ abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveItera
|
||||
$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.');
|
||||
@ -287,6 +292,7 @@ abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveItera
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
$pdfChildArray = new Zend_Pdf_Element_Array();
|
||||
foreach ($this->next as $child) {
|
||||
|
||||
@ -364,7 +370,7 @@ abstract class Zend_Pdf_Action extends Zend_Pdf_Target implements RecursiveItera
|
||||
/**
|
||||
* Returns the child action.
|
||||
*
|
||||
* @return Zend_Pdf_Outline|null
|
||||
* @return Zend_Pdf_Action|null
|
||||
*/
|
||||
public function getChildren()
|
||||
{
|
||||
|
@ -17,16 +17,19 @@
|
||||
* @subpackage Actions
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GoTo.php 17245 2009-07-28 13:59:45Z alexander $
|
||||
* @version $Id: GoTo.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** 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';
|
||||
|
||||
/** Zend_Pdf_Destination */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF 'Go to' action
|
||||
*
|
||||
@ -81,7 +84,7 @@ class Zend_Pdf_Action_GoTo extends Zend_Pdf_Action
|
||||
$dictionary->Type = new Zend_Pdf_Element_Name('Action');
|
||||
$dictionary->S = new Zend_Pdf_Element_Name('GoTo');
|
||||
$dictionary->Next = null;
|
||||
$dictionary->D = $destination->getResource();
|
||||
$dictionary->D = $destination->getResource();
|
||||
|
||||
return new Zend_Pdf_Action_GoTo($dictionary, new SplObjectStorage());
|
||||
}
|
||||
@ -111,4 +114,3 @@ class Zend_Pdf_Action_GoTo extends Zend_Pdf_Action
|
||||
return $this->_destination;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,8 @@
|
||||
* @version $Id:
|
||||
*/
|
||||
|
||||
/** @see Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* Abstract PDF annotation representation class
|
||||
@ -169,6 +168,8 @@ abstract class Zend_Pdf_Annotation
|
||||
* @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);
|
||||
@ -220,7 +221,7 @@ abstract class Zend_Pdf_Annotation
|
||||
*
|
||||
* @internal
|
||||
* @param $destinationArray
|
||||
* @return Zend_Pdf_Destination
|
||||
* @return Zend_Pdf_Annotation
|
||||
*/
|
||||
public static function load(Zend_Pdf_Element $resource)
|
||||
{
|
||||
|
@ -20,10 +20,18 @@
|
||||
* @version $Id:
|
||||
*/
|
||||
|
||||
/** 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.
|
||||
|
@ -20,13 +20,17 @@
|
||||
* @version $Id:
|
||||
*/
|
||||
|
||||
/** 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';
|
||||
|
||||
/** Zend_Pdf_Destination */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
|
||||
/**
|
||||
* A link annotation represents either a hypertext link to a destination elsewhere in
|
||||
* the document or an action to be performed.
|
||||
@ -148,8 +152,10 @@ class Zend_Pdf_Annotation_Link extends Zend_Pdf_Annotation
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -20,10 +20,18 @@
|
||||
* @version $Id:
|
||||
*/
|
||||
|
||||
/** 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.
|
||||
*
|
||||
|
@ -17,20 +17,9 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Cmap.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Cmap.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap_ByteEncoding */
|
||||
require_once 'Zend/Pdf/Cmap/ByteEncoding.php';
|
||||
|
||||
/** Zend_Pdf_Cmap_ByteEncoding_Static */
|
||||
require_once 'Zend/Pdf/Cmap/ByteEncoding/Static.php';
|
||||
|
||||
/** Zend_Pdf_Cmap_SegmentToDelta */
|
||||
require_once 'Zend/Pdf/Cmap/SegmentToDelta.php';
|
||||
|
||||
/** Zend_Pdf_Cmap_TrimmedTable */
|
||||
require_once 'Zend/Pdf/Cmap/TrimmedTable.php';
|
||||
|
||||
/**
|
||||
* Abstract helper class for {@link Zend_Pdf_Resource_Font} which manages font
|
||||
@ -157,9 +146,11 @@ abstract class Zend_Pdf_Cmap
|
||||
{
|
||||
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:
|
||||
@ -168,9 +159,11 @@ abstract class Zend_Pdf_Cmap
|
||||
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:
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ByteEncoding.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: ByteEncoding.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
@ -119,9 +119,9 @@ class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap
|
||||
/**
|
||||
* 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
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
@ -150,6 +150,7 @@ class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
@ -158,12 +159,14 @@ class Zend_Pdf_Cmap_ByteEncoding extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Static.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Static.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap_ByteEncoding */
|
||||
@ -52,6 +52,7 @@ class Zend_Pdf_Cmap_ByteEncoding_Static extends Zend_Pdf_Cmap_ByteEncoding
|
||||
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);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: SegmentToDelta.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: SegmentToDelta.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
@ -261,13 +261,13 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
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
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
@ -276,7 +276,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
public function getCoveredCharactersGlyphs()
|
||||
{
|
||||
$glyphNumbers = array();
|
||||
|
||||
|
||||
for ($segmentNum = 1; $segmentNum <= $this->_segmentCount; $segmentNum++) {
|
||||
if ($this->_segmentTableIdRangeOffsets[$segmentNum] == 0) {
|
||||
$delta = $this->_segmentTableIdDeltas[$segmentNum];
|
||||
@ -298,7 +298,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $glyphNumbers;
|
||||
}
|
||||
|
||||
@ -321,6 +321,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
@ -329,12 +330,14 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
@ -395,6 +398,7 @@ class Zend_Pdf_Cmap_SegmentToDelta extends Zend_Pdf_Cmap
|
||||
* 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);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrimmedTable.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: TrimmedTable.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
@ -134,9 +134,9 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap
|
||||
/**
|
||||
* 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
|
||||
* call, but this method do it in more effective way (prepare complete list instead of searching
|
||||
* glyph for each character code).
|
||||
*
|
||||
* @internal
|
||||
@ -170,6 +170,7 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
@ -178,12 +179,14 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap
|
||||
*/
|
||||
$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);
|
||||
}
|
||||
@ -203,6 +206,7 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap
|
||||
$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);
|
||||
}
|
||||
@ -218,6 +222,7 @@ class Zend_Pdf_Cmap_TrimmedTable extends Zend_Pdf_Cmap
|
||||
* 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);
|
||||
}
|
||||
|
@ -16,15 +16,16 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Cmyk.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: Cmyk.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/**
|
||||
* CMYK color implementation
|
||||
*
|
||||
|
@ -16,15 +16,17 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: GrayScale.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: GrayScale.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/**
|
||||
* GrayScale color implementation
|
||||
*
|
||||
|
@ -16,17 +16,12 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Html.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: Html.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/** Zend_Pdf_Color_Rgb */
|
||||
require_once 'Zend/Pdf/Color/Rgb.php';
|
||||
|
||||
/** Zend_Pdf_GrayScale */
|
||||
require_once 'Zend/Pdf/Color/GrayScale.php';
|
||||
|
||||
/**
|
||||
* HTML color implementation
|
||||
@ -99,8 +94,10 @@ class Zend_Pdf_Color_Html extends Zend_Pdf_Color
|
||||
$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 {
|
||||
@ -405,10 +402,11 @@ class Zend_Pdf_Color_Html extends Zend_Pdf_Color
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,15 +16,17 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Rgb.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: Rgb.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/**
|
||||
* RGB color implementation
|
||||
*
|
||||
|
@ -17,14 +17,13 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Destination.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Destination.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Zend_Pdf_Page */
|
||||
require_once 'Zend/Pdf/Page.php';
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Target */
|
||||
require_once 'Zend/Pdf/Target.php';
|
||||
@ -49,6 +48,7 @@ abstract class Zend_Pdf_Destination extends Zend_Pdf_Target
|
||||
*/
|
||||
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);
|
||||
|
@ -20,13 +20,14 @@
|
||||
* @version $Id: Destination.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Page */
|
||||
require_once 'Zend/Pdf/Page.php';
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Destination */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract PDF explicit destination representation class
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Fit.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Fit.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBox.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitBoundingBox.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBoxHorizontally.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitBoundingBoxHorizontally.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,18 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitBoundingBoxVertically.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitBoundingBoxVertically.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitHorizontally.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitHorizontally.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitRectangle.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitRectangle.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FitVertically.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: FitVertically.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -20,10 +20,14 @@
|
||||
* @version $Id: Fit.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
*/
|
||||
|
||||
/** 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]
|
||||
*
|
||||
|
@ -17,13 +17,19 @@
|
||||
* @subpackage Destination
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Zoom.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Zoom.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** 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
|
||||
*
|
||||
|
@ -16,14 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Element.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: Element.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file element implementation
|
||||
*
|
||||
@ -131,8 +127,10 @@ abstract class 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();
|
||||
@ -146,13 +144,15 @@ abstract class Zend_Pdf_Element
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Array.php 17532 2009-08-10 19:04:14Z alexander $
|
||||
* @version $Id: Array.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -57,11 +57,13 @@ class Zend_Pdf_Element_Array extends Zend_Pdf_Element
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Boolean.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Boolean.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@ class Zend_Pdf_Element_Boolean extends Zend_Pdf_Element
|
||||
public function __construct($val)
|
||||
{
|
||||
if (! is_bool($val)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Argument must be boolean.');
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,17 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Dictionary.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Dictionary.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'dictionary' element implementation
|
||||
*
|
||||
@ -54,14 +57,17 @@ class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element
|
||||
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;
|
||||
@ -145,6 +151,7 @@ class Zend_Pdf_Element_Dictionary extends Zend_Pdf_Element
|
||||
|
||||
foreach ($this->_items as $name => $element) {
|
||||
if (!is_object($element)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong data');
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Name.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Name.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -52,6 +52,7 @@ class Zend_Pdf_Element_Name extends Zend_Pdf_Element
|
||||
{
|
||||
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;
|
||||
|
@ -16,16 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Object.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Object.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'indirect object' element implementation
|
||||
@ -77,14 +74,17 @@ class Zend_Pdf_Element_Object extends Zend_Pdf_Element
|
||||
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
|
||||
{
|
||||
if ($val instanceof self) {
|
||||
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.');
|
||||
}
|
||||
|
||||
|
@ -16,32 +16,19 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Stream.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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';
|
||||
|
||||
/** Zend_Pdf_Element_Stream */
|
||||
require_once 'Zend/Pdf/Element/Stream.php';
|
||||
|
||||
/** Zend_Pdf_Filter_Ascii85 */
|
||||
require_once 'Zend/Pdf/Filter/Ascii85.php';
|
||||
|
||||
/** Zend_Pdf_Filter_AsciiHex */
|
||||
require_once 'Zend/Pdf/Filter/AsciiHex.php';
|
||||
|
||||
/** Zend_Pdf_Filter_Compression_Flate */
|
||||
require_once 'Zend/Pdf/Filter/Compression/Flate.php';
|
||||
|
||||
/** Zend_Pdf_Filter_Compression_Lzw */
|
||||
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'stream object' element implementation
|
||||
*
|
||||
@ -194,6 +181,7 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
*/
|
||||
if (isset($this->_originalDictionary['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.');
|
||||
}
|
||||
|
||||
@ -202,24 +190,29 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
$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->_originalDictionary['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'LZWDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef,
|
||||
$this->_originalDictionary['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
|
||||
}
|
||||
}
|
||||
@ -240,6 +233,7 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
*/
|
||||
if (isset($this->_originalDictionary['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.');
|
||||
}
|
||||
|
||||
@ -250,24 +244,29 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
$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->_originalDictionary['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
case 'LZWDecode':
|
||||
require_once 'Zend/Pdf/Filter/Compression/Lzw.php';
|
||||
$valueRef = Zend_Pdf_Filter_Compression_Lzw::encode($valueRef,
|
||||
$this->_originalDictionary['DecodeParms'][$id]);
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.');
|
||||
}
|
||||
}
|
||||
@ -303,6 +302,7 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
return $this->_value->value->getRef();
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream object property requested.');
|
||||
}
|
||||
|
||||
@ -325,6 +325,7 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
return;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown stream object property: \'' . $property . '\'.');
|
||||
}
|
||||
|
||||
@ -357,6 +358,7 @@ class Zend_Pdf_Element_Object_Stream extends Zend_Pdf_Element_Object
|
||||
case 1:
|
||||
return $this->_value->$method($args[0]);
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported number of arguments');
|
||||
}
|
||||
}
|
||||
|
@ -16,23 +16,17 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Reference.php 17533 2009-08-10 19:06:27Z alexander $
|
||||
* @version $Id: Reference.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Context */
|
||||
require_once 'Zend/Pdf/Element/Reference/Context.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Table */
|
||||
require_once 'Zend/Pdf/Element/Reference/Table.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'reference' element implementation
|
||||
*
|
||||
@ -97,9 +91,11 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
|
||||
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');
|
||||
}
|
||||
|
||||
@ -178,6 +174,7 @@ class Zend_Pdf_Element_Reference extends Zend_Pdf_Element
|
||||
}
|
||||
|
||||
if ($obj->toString() != $this->_objNum . ' ' . $this->_genNum . ' R') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Incorrect reference to the object');
|
||||
}
|
||||
|
||||
|
@ -16,17 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Context.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
* @version $Id: Context.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_StringParser */
|
||||
require_once 'Zend/Pdf/StringParser.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Table */
|
||||
require_once 'Zend/Pdf/Element/Reference/Table.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF reference object context
|
||||
* Reference context is defined by PDF parser and PDF Refernce table
|
||||
@ -41,7 +34,7 @@ class Zend_Pdf_Element_Reference_Context
|
||||
/**
|
||||
* PDF parser object.
|
||||
*
|
||||
* @var Zend_Pdf_Parser
|
||||
* @var Zend_Pdf_StringParser
|
||||
*/
|
||||
private $_stringParser;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Table.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Table.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -93,6 +93,7 @@ class Zend_Pdf_Element_Reference_Table
|
||||
{
|
||||
$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];
|
||||
@ -153,6 +154,7 @@ class Zend_Pdf_Element_Reference_Table
|
||||
public function getNextFree($ref)
|
||||
{
|
||||
if (isset($this->_inuse[$ref])) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not free');
|
||||
}
|
||||
|
||||
@ -164,6 +166,7 @@ class Zend_Pdf_Element_Reference_Table
|
||||
return $this->_parent->getNextFree($ref);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object not found.');
|
||||
}
|
||||
|
||||
@ -177,6 +180,7 @@ class Zend_Pdf_Element_Reference_Table
|
||||
public function getNewGeneration($objNum)
|
||||
{
|
||||
if (isset($this->_usedObjects[$objNum])) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object is not free');
|
||||
}
|
||||
|
||||
@ -188,7 +192,7 @@ class Zend_Pdf_Element_Reference_Table
|
||||
return $this->_parent->getNewGeneration($objNum);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Object not found.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,24 +16,16 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Stream.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Stream.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Pdf
|
||||
*/
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Pdf_Element
|
||||
*/
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Memory
|
||||
*/
|
||||
require_once 'Zend/Memory.php';
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/**
|
||||
* PDF file 'stream' element implementation
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: String.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file 'string' element implementation
|
||||
*
|
||||
@ -78,170 +77,187 @@ class Zend_Pdf_Element_String extends Zend_Pdf_Element
|
||||
/**
|
||||
* Escape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public static function escape($inStr)
|
||||
public static function escape($str)
|
||||
{
|
||||
$outStr = '';
|
||||
$lastNL = 0;
|
||||
$outEntries = array();
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
if (strlen($outStr) - $lastNL > 128) {
|
||||
$outStr .= "\\\n";
|
||||
$lastNL = strlen($outStr);
|
||||
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);
|
||||
}
|
||||
|
||||
$nextCode = ord($inStr[$count]);
|
||||
switch ($nextCode) {
|
||||
// "\n" - line feed (LF)
|
||||
case 10:
|
||||
$outStr .= '\\n';
|
||||
break;
|
||||
|
||||
// "\r" - carriage return (CR)
|
||||
case 13:
|
||||
$outStr .= '\\r';
|
||||
break;
|
||||
|
||||
// "\t" - horizontal tab (HT)
|
||||
case 9:
|
||||
$outStr .= '\\t';
|
||||
break;
|
||||
|
||||
// "\b" - backspace (BS)
|
||||
case 8:
|
||||
$outStr .= '\\b';
|
||||
break;
|
||||
|
||||
// "\f" - form feed (FF)
|
||||
case 12:
|
||||
$outStr .= '\\f';
|
||||
break;
|
||||
|
||||
// '(' - left paranthesis
|
||||
case 40:
|
||||
$outStr .= '\\(';
|
||||
break;
|
||||
|
||||
// ')' - right paranthesis
|
||||
case 41:
|
||||
$outStr .= '\\)';
|
||||
break;
|
||||
|
||||
// '\' - backslash
|
||||
case 92:
|
||||
$outStr .= '\\\\';
|
||||
break;
|
||||
|
||||
default:
|
||||
// Don't use non-ASCII characters escaping
|
||||
// if ($nextCode >= 32 && $nextCode <= 126 ) {
|
||||
// // Visible ASCII symbol
|
||||
// $outStr .= $inStr[$count];
|
||||
// } else {
|
||||
// $outStr .= sprintf('\\%03o', $nextCode);
|
||||
// }
|
||||
$outStr .= $inStr[$count];
|
||||
|
||||
break;
|
||||
}
|
||||
$outEntries[] = $chunkOut;
|
||||
}
|
||||
|
||||
return $outStr;
|
||||
return implode("\\\n", $outEntries);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unescape string according to the PDF rules
|
||||
*
|
||||
* @param string $inStr
|
||||
* @param string $str
|
||||
* @return string
|
||||
*/
|
||||
public static function unescape($inStr)
|
||||
public static function unescape($str)
|
||||
{
|
||||
$outStr = '';
|
||||
$outEntries = array();
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
if ($inStr[$count] != '\\' || $count == strlen($inStr)-1) {
|
||||
$outStr .= $inStr[$count];
|
||||
} else { // Escape sequence
|
||||
switch ($inStr{++$count}) {
|
||||
$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':
|
||||
$outStr .= "\n";
|
||||
$outEntries[] = "\n";
|
||||
break;
|
||||
|
||||
// '\\r' - carriage return (CR)
|
||||
case 'r':
|
||||
$outStr .= "\r";
|
||||
$outEntries[] = "\r";
|
||||
break;
|
||||
|
||||
// '\\t' - horizontal tab (HT)
|
||||
case 't':
|
||||
$outStr .= "\t";
|
||||
$outEntries[] = "\t";
|
||||
break;
|
||||
|
||||
// '\\b' - backspace (BS)
|
||||
case 'b':
|
||||
$outStr .= "\x08";
|
||||
$outEntries[] = "\x08";
|
||||
break;
|
||||
|
||||
// '\\f' - form feed (FF)
|
||||
case 'f':
|
||||
$outStr .= "\x0C";
|
||||
$outEntries[] = "\x0C";
|
||||
break;
|
||||
|
||||
// '\\(' - left paranthesis
|
||||
case '(':
|
||||
$outStr .= '(';
|
||||
$outEntries[] = '(';
|
||||
break;
|
||||
|
||||
// '\\)' - right paranthesis
|
||||
case ')':
|
||||
$outStr .= ')';
|
||||
$outEntries[] = ')';
|
||||
break;
|
||||
|
||||
// '\\\\' - backslash
|
||||
case '\\':
|
||||
$outStr .= '\\';
|
||||
$outEntries[] = '\\';
|
||||
break;
|
||||
|
||||
// "\\\n" or "\\\n\r"
|
||||
case "\n":
|
||||
// skip new line symbol
|
||||
if ($inStr[$count+1] == "\r") {
|
||||
$count++;
|
||||
if ($str[$offset + 1] == "\r") {
|
||||
$offset++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ord($inStr[$count]) >= ord('0') &&
|
||||
ord($inStr[$count]) <= ord('9')) {
|
||||
if (strpos('0123456789', $str[$offset]) !== false) {
|
||||
// Character in octal representation
|
||||
// '\\xxx'
|
||||
$nextCode = '0' . $inStr[$count];
|
||||
$nextCode = '0' . $str[$offset];
|
||||
|
||||
if (ord($inStr[$count+1]) >= ord('0') &&
|
||||
ord($inStr[$count+1]) <= ord('9')) {
|
||||
$nextCode .= $inStr{++$count};
|
||||
if (strpos('0123456789', $str[$offset + 1]) !== false) {
|
||||
$nextCode .= $str[++$offset];
|
||||
|
||||
if (ord($inStr[$count+1]) >= ord('0') &&
|
||||
ord($inStr[$count+1]) <= ord('9')) {
|
||||
$nextCode .= $inStr{++$count};
|
||||
if (strpos('0123456789', $str[$offset + 1]) !== false) {
|
||||
$nextCode .= $str[++$offset];
|
||||
}
|
||||
}
|
||||
|
||||
$outStr .= chr($nextCode);
|
||||
$outEntries[] = chr($nextCode);
|
||||
} else {
|
||||
$outStr .= $inStr[$count];
|
||||
$outEntries[] = $str[$offset];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$offset++;
|
||||
}
|
||||
}
|
||||
|
||||
return $outStr;
|
||||
return implode($outEntries);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Binary.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Binary.php 18985 2009-11-14 18:51:34Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
@ -50,12 +50,7 @@ class Zend_Pdf_Element_String_Binary extends Zend_Pdf_Element_String
|
||||
*/
|
||||
public static function escape($inStr)
|
||||
{
|
||||
$outStr = '';
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
$outStr .= sprintf('%02X', ord($inStr[$count]));
|
||||
}
|
||||
return $outStr;
|
||||
return strtoupper(bin2hex($inStr));
|
||||
}
|
||||
|
||||
|
||||
@ -67,34 +62,26 @@ class Zend_Pdf_Element_String_Binary extends Zend_Pdf_Element_String
|
||||
*/
|
||||
public static function unescape($inStr)
|
||||
{
|
||||
$outStr = '';
|
||||
$nextHexCode = '';
|
||||
$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));
|
||||
|
||||
for ($count = 0; $count < strlen($inStr); $count++) {
|
||||
$nextCharCode = ord($inStr[$count]);
|
||||
|
||||
if( ($nextCharCode >= 48 /*'0'*/ &&
|
||||
$nextCharCode <= 57 /*'9'*/ ) ||
|
||||
($nextCharCode >= 97 /*'a'*/ &&
|
||||
$nextCharCode <= 102 /*'f'*/ ) ||
|
||||
($nextCharCode >= 65 /*'A'*/ &&
|
||||
$nextCharCode <= 70 /*'F'*/ ) ) {
|
||||
$nextHexCode .= $inStr[$count];
|
||||
}
|
||||
|
||||
if (strlen($nextHexCode) == 2) {
|
||||
$outStr .= chr(intval($nextHexCode, 16));
|
||||
$nextHexCode = '';
|
||||
}
|
||||
// Skip non-hexadecimal characters
|
||||
$offset += strcspn($inStr, "0123456789abcdefABCDEF", $offset);
|
||||
}
|
||||
|
||||
if ($nextHexCode != '') {
|
||||
if ($length % 2 != 0) {
|
||||
// We have odd number of digits.
|
||||
// Final digit is assumed to be '0'
|
||||
$outStr .= chr(base_convert($nextHexCode . '0', 16, 10));
|
||||
$chunks[] = '0';
|
||||
}
|
||||
|
||||
return $outStr;
|
||||
return pack('H*' , implode($chunks));
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,56 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ElementFactory.php 17533 2009-08-10 19:06:27Z alexander $
|
||||
* @version $Id: ElementFactory.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Proxy */
|
||||
require_once 'Zend/Pdf/ElementFactory/Proxy.php';
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_Element_Array */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
|
||||
/** Zend_Pdf_Element_String_Binary */
|
||||
require_once 'Zend/Pdf/Element/String/Binary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Boolean */
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference */
|
||||
require_once 'Zend/Pdf/Element/Reference.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object_Stream */
|
||||
require_once 'Zend/Pdf/Element/Object/Stream.php';
|
||||
|
||||
/** Zend_Pdf_Element_String */
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
/** Zend_Pdf_Element_Null */
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
|
||||
/** Zend_Pdf_UpdateInfoContainer */
|
||||
require_once 'Zend/Pdf/UpdateInfoContainer.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF element factory.
|
||||
* Responsibility is to log PDF changes
|
||||
@ -167,6 +124,7 @@ class Zend_Pdf_ElementFactory implements 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));
|
||||
}
|
||||
|
||||
@ -292,9 +250,6 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
/**
|
||||
* 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()
|
||||
{
|
||||
@ -315,6 +270,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
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');
|
||||
}
|
||||
|
||||
@ -330,6 +286,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
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');
|
||||
}
|
||||
|
||||
@ -346,6 +303,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
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');
|
||||
}
|
||||
|
||||
@ -364,6 +322,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
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;
|
||||
@ -379,6 +338,7 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
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;
|
||||
@ -404,9 +364,10 @@ class Zend_Pdf_ElementFactory implements Zend_Pdf_ElementFactory_Interface
|
||||
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,
|
||||
$result[$objNum+$shift] = new Zend_Pdf_UpdateInfoContainer($objNum + $shift,
|
||||
$obj->getGenNum()+1,
|
||||
true);
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Interface.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Interface.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -149,4 +149,3 @@ interface Zend_Pdf_ElementFactory_Interface
|
||||
*/
|
||||
public function isModified();
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,12 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Proxy.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Proxy.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF element factory interface.
|
||||
* Responsibility is to log PDF changes
|
||||
@ -223,4 +222,3 @@ class Zend_Pdf_ElementFactory_Proxy implements Zend_Pdf_ElementFactory_Interface
|
||||
return $this->_factory->isModified();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,9 +17,13 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Font.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Font.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser */
|
||||
require_once 'Zend/Pdf/FileParser.php';
|
||||
|
||||
@ -206,8 +210,8 @@ abstract class Zend_Pdf_FileParser_Font extends Zend_Pdf_FileParser
|
||||
$message = vsprintf($message, $args);
|
||||
}
|
||||
|
||||
require_once 'Zend/Log.php';
|
||||
$logger = new Zend_Log();
|
||||
$logger->log($message, Zend_Log::DEBUG);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,16 +17,12 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: OpenType.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: OpenType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParser_Font */
|
||||
require_once 'Zend/Pdf/FileParser/Font.php';
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract base class for OpenType font file parsers.
|
||||
*
|
||||
@ -166,6 +162,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
* are defined, so use 50 as a practical limit.
|
||||
*/
|
||||
if (($tableCount < 7) || ($tableCount > 50)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Table count not within expected range',
|
||||
Zend_Pdf_Exception::BAD_TABLE_COUNT);
|
||||
}
|
||||
@ -196,10 +193,12 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$fileSize = $this->_dataSource->getSize();
|
||||
if (($tableOffset < 0) || ($tableOffset > $fileSize)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table offset ($tableOffset) not within expected range",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
if (($tableLength < 0) || (($tableOffset + $tableLength) > $fileSize)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Table length ($tableLength) not within expected range",
|
||||
Zend_Pdf_Exception::INDEX_OUT_OF_RANGE);
|
||||
}
|
||||
@ -232,6 +231,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
|
||||
$magicNumber = $this->readUInt(4);
|
||||
if ($magicNumber != 0x5f0f3cf5) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong magic number. Expected: 0x5f0f3cf5; actual: '
|
||||
. sprintf('%x', $magicNumber),
|
||||
Zend_Pdf_Exception::BAD_MAGIC_NUMBER);
|
||||
@ -292,6 +292,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableFormat = $this->readUInt(2);
|
||||
if ($tableFormat != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read format $tableFormat table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -492,6 +493,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
protected function _parseOs2Table()
|
||||
{
|
||||
if (! $this->numberHMetrics) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("hhea table must be parsed prior to calling this method",
|
||||
Zend_Pdf_Exception::PARSED_OUT_OF_ORDER);
|
||||
}
|
||||
@ -501,6 +503,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
} catch (Zend_Pdf_Exception $exception) {
|
||||
/* This table is not always present. If missing, use default values.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
if ($exception->getCode() == Zend_Pdf_Exception::REQUIRED_TABLE_NOT_FOUND) {
|
||||
$this->_debugLog('No OS/2 table found. Using default values');
|
||||
$this->fontWeight = Zend_Pdf_Font::WEIGHT_NORMAL;
|
||||
@ -547,6 +550,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableVersion = $this->readUInt(2);
|
||||
if (($tableVersion < 0) || ($tableVersion > 3)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -728,6 +732,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
$this->_jumpToTable('hmtx');
|
||||
|
||||
if (! $this->numberHMetrics) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("hhea table must be parsed prior to calling this method",
|
||||
Zend_Pdf_Exception::PARSED_OUT_OF_ORDER);
|
||||
}
|
||||
@ -735,6 +740,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
/* We only understand version 0 tables.
|
||||
*/
|
||||
if ($this->metricDataFormat != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read format $this->metricDataFormat table.",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -787,6 +793,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
*/
|
||||
$tableVersion = $this->readUInt(2);
|
||||
if ($tableVersion != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
@ -915,6 +922,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
}
|
||||
if ($cmapType == -1) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unable to find usable cmap table',
|
||||
Zend_Pdf_Exception::CANT_FIND_GOOD_CMAP);
|
||||
}
|
||||
@ -925,6 +933,8 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
$cmapType, $cmapOffset, $cmapLength);
|
||||
$this->moveToOffset($cmapOffset);
|
||||
$cmapData = $this->readBytes($cmapLength);
|
||||
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->cmap = Zend_Pdf_Cmap::cmapWithTypeData($cmapType, $cmapData);
|
||||
}
|
||||
|
||||
@ -964,10 +974,12 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
|
||||
case 0x74797031: // 'typ1'
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported font type: PostScript in sfnt wrapper',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not an OpenType font file',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
}
|
||||
@ -984,6 +996,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
protected function _jumpToTable($tableName)
|
||||
{
|
||||
if (empty($this->_tableDirectory[$tableName])) { // do not allow NULL or zero
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Required table '$tableName' not found!",
|
||||
Zend_Pdf_Exception::REQUIRED_TABLE_NOT_FOUND);
|
||||
}
|
||||
@ -1005,6 +1018,7 @@ abstract class Zend_Pdf_FileParser_Font_OpenType extends Zend_Pdf_FileParser_Fon
|
||||
{
|
||||
$tableVersion = $this->readFixed(16, 16);
|
||||
if (($tableVersion < $minVersion) || ($tableVersion > $maxVersion)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unable to read version $tableVersion table",
|
||||
Zend_Pdf_Exception::DONT_UNDERSTAND_TABLE_VERSION);
|
||||
}
|
||||
|
@ -17,13 +17,13 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrueType.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: TrueType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parses an OpenType font file containing TrueType outlines.
|
||||
*
|
||||
@ -60,6 +60,7 @@ class Zend_Pdf_FileParser_Font_OpenType_TrueType extends Zend_Pdf_FileParser_Fon
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not a TrueType font file',
|
||||
Zend_Pdf_Exception::WRONG_FONT_TYPE);
|
||||
}
|
||||
|
@ -17,12 +17,17 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Image.php 17182 2009-07-27 13:54:11Z alexander $
|
||||
* @version $Id: Image.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Pdf_FileParser
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
|
||||
/** Zend_Pdf_Image */
|
||||
require_once 'Zend/Pdf/Image.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_FileParser */
|
||||
require_once 'Zend/Pdf/FileParser.php';
|
||||
|
||||
/**
|
||||
@ -55,5 +60,4 @@ abstract class Zend_Pdf_FileParser_Image extends Zend_Pdf_FileParser
|
||||
parent::__construct($dataSource);
|
||||
$this->imageType = Zend_Pdf_Image::TYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Png.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Png.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParser_Image */
|
||||
@ -178,6 +178,7 @@ class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image
|
||||
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.");
|
||||
}
|
||||
|
||||
@ -208,6 +209,7 @@ class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image
|
||||
}
|
||||
}
|
||||
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." );
|
||||
}
|
||||
}
|
||||
@ -215,6 +217,7 @@ class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image
|
||||
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);
|
||||
@ -225,6 +228,7 @@ class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image
|
||||
$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." );
|
||||
}
|
||||
}
|
||||
@ -317,10 +321,9 @@ class Zend_Pdf_FileParser_Image_Png extends Zend_Pdf_FileParser_Image
|
||||
case Zend_Pdf_Image::PNG_CHANNEL_GRAY_ALPHA:
|
||||
//Fall through to the next case
|
||||
case Zend_Pdf_Image::PING_CHANNEL_RGB_ALPHA:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception( "tRNS chunk illegal for Alpha Channel Images" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: File.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: File.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
@ -75,18 +75,22 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
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);
|
||||
}
|
||||
@ -122,10 +126,12 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
{
|
||||
$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);
|
||||
}
|
||||
@ -178,10 +184,12 @@ class Zend_Pdf_FileParserDataSource_File extends Zend_Pdf_FileParserDataSource
|
||||
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);
|
||||
}
|
||||
|
@ -17,13 +17,12 @@
|
||||
* @subpackage FileParser
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: String.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: String.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
|
||||
/**
|
||||
* Concrete subclass of {@link Zend_Pdf_FileParserDataSource} that provides an
|
||||
* interface to binary strings.
|
||||
@ -61,6 +60,7 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
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);
|
||||
}
|
||||
@ -92,6 +92,7 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
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);
|
||||
}
|
||||
@ -124,5 +125,4 @@ class Zend_Pdf_FileParserDataSource_String extends Zend_Pdf_FileParserDataSource
|
||||
{
|
||||
return "String ($this->_size bytes)";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ascii85.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Ascii85.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* ASCII85 stream filter
|
||||
*
|
||||
@ -43,6 +42,7 @@ class Zend_Pdf_Filter_Ascii85 implements Zend_Pdf_Filter_Interface
|
||||
*/
|
||||
public static function encode($data, $params = null)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
}
|
||||
|
||||
@ -56,6 +56,7 @@ class Zend_Pdf_Filter_Ascii85 implements Zend_Pdf_Filter_Interface
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AsciiHex.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: AsciiHex.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* AsciiHex stream filter
|
||||
*
|
||||
@ -100,6 +99,7 @@ class Zend_Pdf_Filter_AsciiHex implements Zend_Pdf_Filter_Interface
|
||||
} 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');
|
||||
}
|
||||
|
||||
@ -121,6 +121,7 @@ class Zend_Pdf_Filter_AsciiHex implements Zend_Pdf_Filter_Interface
|
||||
|
||||
/* 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.');
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Compression.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Compression.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Interface */
|
||||
require_once 'Zend/Pdf/Filter/Interface.php';
|
||||
|
||||
|
||||
/**
|
||||
* ASCII85 stream filter
|
||||
*
|
||||
@ -76,6 +75,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
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;
|
||||
@ -97,6 +97,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
$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;
|
||||
@ -120,6 +121,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
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;
|
||||
@ -165,6 +167,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
|
||||
/** TIFF Predictor 2 */
|
||||
if ($predictor == 2) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet' );
|
||||
}
|
||||
|
||||
@ -184,6 +187,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
$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.");
|
||||
}
|
||||
|
||||
@ -195,6 +199,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
$offset = 0;
|
||||
|
||||
if (!is_integer($rows)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Wrong data length.');
|
||||
}
|
||||
|
||||
@ -273,6 +278,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
return $output;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unknown prediction algorithm - ' . $predictor . '.' );
|
||||
}
|
||||
|
||||
@ -296,6 +302,7 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
|
||||
/** TIFF Predictor 2 */
|
||||
if ($predictor == 2) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet' );
|
||||
}
|
||||
|
||||
@ -371,12 +378,14 @@ abstract class Zend_Pdf_Filter_Compression implements Zend_Pdf_Filter_Interface
|
||||
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 . '.' );
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Flate.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Flate.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Compression */
|
||||
require_once 'Zend/Pdf/Filter/Compression.php';
|
||||
|
||||
|
||||
/**
|
||||
* Flate stream filter
|
||||
*
|
||||
@ -53,11 +52,13 @@ class Zend_Pdf_Filter_Compression_Flate extends Zend_Pdf_Filter_Compression
|
||||
|
||||
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.');
|
||||
}
|
||||
|
||||
@ -82,11 +83,13 @@ class Zend_Pdf_Filter_Compression_Flate extends Zend_Pdf_Filter_Compression
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Lzw.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Lzw.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Filter_Compression */
|
||||
require_once 'Zend/Pdf/Filter/Compression.php';
|
||||
|
||||
|
||||
/**
|
||||
* LZW stream filter
|
||||
*
|
||||
@ -46,6 +45,7 @@ class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression
|
||||
$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;
|
||||
@ -69,6 +69,7 @@ class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression
|
||||
$data = self::_applyEncodeParams($data, $params);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
}
|
||||
|
||||
@ -82,6 +83,7 @@ class Zend_Pdf_Filter_Compression_Lzw extends Zend_Pdf_Filter_Compression
|
||||
*/
|
||||
public static function decode($data, $params = null)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Not implemented yet');
|
||||
|
||||
if ($params !== null) {
|
||||
|
@ -17,75 +17,9 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Font.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource_File */
|
||||
require_once 'Zend/Pdf/FileParserDataSource/File.php';
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource_String */
|
||||
require_once 'Zend/Pdf/FileParserDataSource/String.php';
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType_TrueType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType/TrueType.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Parsed_TrueType */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Parsed/TrueType.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Type0 */
|
||||
require_once 'Zend/Pdf/Resource/Font/Type0.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_CidFont_TrueType */
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont/TrueType.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_Courier */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Courier.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_CourierBold */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_CourierBoldOblique */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_CourierOblique */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_Helvetica */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBold */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBoldOblique */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_HelveticaOblique */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_Symbol */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_TimesBold */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_TimesBoldItalic */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_TimesItalic */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_TimesRoman */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Extracted */
|
||||
require_once 'Zend/Pdf/Resource/Font/Extracted.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract factory class which vends {@link Zend_Pdf_Resource_Font} objects.
|
||||
@ -547,62 +481,77 @@ abstract class Zend_Pdf_Font
|
||||
*/
|
||||
switch ($name) {
|
||||
case Zend_Pdf_Font::FONT_COURIER:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Courier.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_Courier();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_COURIER_BOLD:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_CourierBold();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_COURIER_OBLIQUE:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_CourierOblique();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_COURIER_BOLD_OBLIQUE:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_CourierBoldOblique();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_HELVETICA:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_Helvetica();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_HELVETICA_BOLD:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBold();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_HELVETICA_OBLIQUE:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_HelveticaOblique();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_HELVETICA_BOLD_OBLIQUE:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBoldOblique();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_SYMBOL:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_Symbol();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_TIMES_ROMAN:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_TimesRoman();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_TIMES_BOLD:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_TimesBold();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_TIMES_ITALIC:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_TimesItalic();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_TIMES_BOLD_ITALIC:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_TimesBoldItalic();
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Font::FONT_ZAPFDINGBATS:
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats();
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Excaption.php';
|
||||
throw new Zend_Pdf_Exception("Unknown font name: $name",
|
||||
Zend_Pdf_Exception::BAD_FONT_NAME);
|
||||
}
|
||||
@ -650,6 +599,7 @@ abstract class Zend_Pdf_Font
|
||||
/* Create a file parser data source object for this file. File path and
|
||||
* access permission checks are handled here.
|
||||
*/
|
||||
require_once 'Zend/Pdf/FileParserDataSource/File.php';
|
||||
$dataSource = new Zend_Pdf_FileParserDataSource_File($filePath);
|
||||
|
||||
/* Attempt to determine the type of font. We can't always trust file
|
||||
@ -713,6 +663,7 @@ abstract class Zend_Pdf_Font
|
||||
} else {
|
||||
/* The type of font could not be determined. Give up.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot determine font type: $filePath",
|
||||
Zend_Pdf_Exception::CANT_DETERMINE_FONT_TYPE);
|
||||
}
|
||||
@ -744,12 +695,16 @@ abstract class Zend_Pdf_Font
|
||||
protected static function _extractTrueTypeFont($dataSource, $embeddingOptions)
|
||||
{
|
||||
try {
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType/TrueType.php';
|
||||
$fontParser = new Zend_Pdf_FileParser_Font_OpenType_TrueType($dataSource);
|
||||
|
||||
$fontParser->parse();
|
||||
if ($fontParser->isAdobeLatinSubset) {
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Parsed/TrueType.php';
|
||||
$font = new Zend_Pdf_Resource_Font_Simple_Parsed_TrueType($fontParser, $embeddingOptions);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont/TrueType.php';
|
||||
require_once 'Zend/Pdf/Resource/Font/Type0.php';
|
||||
/* Use Composite Type 0 font which supports Unicode character mapping */
|
||||
$cidFont = new Zend_Pdf_Resource_Font_CidFont_TrueType($fontParser, $embeddingOptions);
|
||||
$font = new Zend_Pdf_Resource_Font_Type0($cidFont);
|
||||
@ -761,6 +716,7 @@ abstract class Zend_Pdf_Font
|
||||
* a problem; throw the exception again.
|
||||
*/
|
||||
$fontParser = null;
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
switch ($exception->getCode()) {
|
||||
case Zend_Pdf_Exception::WRONG_FONT_TYPE: // break intentionally omitted
|
||||
case Zend_Pdf_Exception::BAD_TABLE_COUNT: // break intentionally omitted
|
||||
@ -773,5 +729,4 @@ abstract class Zend_Pdf_Font
|
||||
}
|
||||
return $font;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,17 +17,9 @@
|
||||
* @subpackage Images
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Image.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Image.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource */
|
||||
require_once 'Zend/Pdf/FileParserDataSource.php';
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource_File */
|
||||
require_once 'Zend/Pdf/FileParserDataSource/File.php';
|
||||
|
||||
/** Zend_Pdf_FileParserDataSource_String */
|
||||
require_once 'Zend/Pdf/FileParserDataSource/String.php';
|
||||
|
||||
/**
|
||||
* Abstract factory class which vends {@link Zend_Pdf_Resource_Image} objects.
|
||||
@ -124,7 +116,6 @@ abstract class Zend_Pdf_Image
|
||||
*/
|
||||
public static function imageWithPath($filePath)
|
||||
{
|
||||
|
||||
/**
|
||||
* use old implementation
|
||||
* @todo switch to new implementation
|
||||
@ -136,6 +127,7 @@ abstract class Zend_Pdf_Image
|
||||
/* Create a file parser data source object for this file. File path and
|
||||
* access permission checks are handled here.
|
||||
*/
|
||||
require_once 'Zend/Pdf/FileParserDataSource/File.php';
|
||||
$dataSource = new Zend_Pdf_FileParserDataSource_File($filePath);
|
||||
|
||||
/* Attempt to determine the type of image. We can't always trust file
|
||||
@ -163,6 +155,7 @@ abstract class Zend_Pdf_Image
|
||||
$image = Zend_Pdf_Image::_extractJpegImage($dataSource);
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot create image resource. File extension not known or unsupported type.");
|
||||
break;
|
||||
}
|
||||
@ -177,17 +170,18 @@ abstract class Zend_Pdf_Image
|
||||
} else {
|
||||
/* The type of image could not be determined. Give up.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot determine image type: $filePath",
|
||||
Zend_Pdf_Exception::CANT_DETERMINE_IMAGE_TYPE);
|
||||
Zend_Pdf_Exception::CANT_DETERMINE_IMAGE_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**** Internal Methods ****/
|
||||
/**** Internal Methods ****/
|
||||
|
||||
|
||||
/* Image Extraction Methods */
|
||||
/* Image Extraction Methods */
|
||||
|
||||
/**
|
||||
* Attempts to extract a JPEG Image from the data source.
|
||||
@ -199,7 +193,12 @@ abstract class Zend_Pdf_Image
|
||||
*/
|
||||
protected static function _extractJpegImage($dataSource)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Jpeg image fileparser is not implemented. Old styly implementation has to be used.');
|
||||
|
||||
require_once 'Zend/Pdf/FileParser/Image/Jpeg.php';
|
||||
$imageParser = new Zend_Pdf_FileParser_Image_Jpeg($dataSource);
|
||||
require_once 'Zend/Pdf/Resource/Image/Jpeg.php';
|
||||
$image = new Zend_Pdf_Resource_Image_Jpeg($imageParser);
|
||||
unset($imageParser);
|
||||
|
||||
@ -212,12 +211,13 @@ abstract class Zend_Pdf_Image
|
||||
* @param Zend_Pdf_FileParserDataSource $dataSource
|
||||
* @return Zend_Pdf_Resource_Image_Png May also return null if
|
||||
* the data source does not appear to contain valid image data.
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
protected static function _extractPngImage($dataSource)
|
||||
{
|
||||
$imageParser = new Zend_Pdf_FileParser_Image_PNG($dataSource);
|
||||
$image = new Zend_Pdf_Resource_Image_PNG($imageParser);
|
||||
require_once 'Zend/Pdf/FileParser/Image/Png.php';
|
||||
$imageParser = new Zend_Pdf_FileParser_Image_Png($dataSource);
|
||||
require_once 'Zend/Pdf/Resource/Image/Png.php';
|
||||
$image = new Zend_Pdf_Resource_Image_Png($imageParser);
|
||||
unset($imageParser);
|
||||
|
||||
return $image;
|
||||
@ -233,14 +233,15 @@ abstract class Zend_Pdf_Image
|
||||
*/
|
||||
protected static function _extractTiffImage($dataSource)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Tiff image fileparser is not implemented. Old styly implementation has to be used.');
|
||||
|
||||
require_once 'Zend/Pdf/FileParser/Image/Tiff.php';
|
||||
$imageParser = new Zend_Pdf_FileParser_Image_Tiff($dataSource);
|
||||
require_once 'Zend/Pdf/Resource/Image/Tiff.php';
|
||||
$image = new Zend_Pdf_Resource_Image_Tiff($imageParser);
|
||||
unset($imageParser);
|
||||
|
||||
return $image;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
* @version $Id: Action.php 16978 2009-07-22 19:59:40Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,9 +20,6 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract PDF outline representation class
|
||||
@ -170,7 +167,7 @@ abstract class Zend_Pdf_Outline implements RecursiveIterator, Countable
|
||||
* Set outline options
|
||||
*
|
||||
* @param array $options
|
||||
* @return Zend_Pdf_Actions
|
||||
* @return Zend_Pdf_Action
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public function setOptions(array $options)
|
||||
@ -232,13 +229,13 @@ abstract class Zend_Pdf_Outline implements RecursiveIterator, Countable
|
||||
*/
|
||||
public static function create($param1, $param2 = null)
|
||||
{
|
||||
require_once 'Zend/Pdf/Outline/Created.php';
|
||||
if (is_string($param1)) {
|
||||
if ($param2 !== null && !($param2 instanceof Zend_Pdf_Target || is_string($param2))) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Outline create method takes $title (string) and $target (Zend_Pdf_Target or string) or an array as an input');
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Outline/Created.php';
|
||||
return new Zend_Pdf_Outline_Created(array('title' => $param1,
|
||||
'target' => $param2));
|
||||
} else {
|
||||
|
@ -20,19 +20,17 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Outline */
|
||||
require_once 'Zend/Pdf/Outline.php';
|
||||
|
||||
/** Zend_Pdf_Destination */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF outline representation class
|
||||
*
|
||||
|
@ -20,19 +20,17 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Outline */
|
||||
require_once 'Zend/Pdf/Outline.php';
|
||||
|
||||
/** Zend_Pdf_Destination */
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
|
||||
/** Zend_Pdf_Action */
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
|
||||
|
||||
/**
|
||||
* Traceable PDF outline representation class
|
||||
*
|
||||
@ -239,8 +237,10 @@ class Zend_Pdf_Outline_Loaded extends Zend_Pdf_Outline
|
||||
throw new Zend_Pdf_Exception('Outline dictionary may contain Dest or A entry, but not both.');
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
return Zend_Pdf_Destination::load($this->_outlineDictionary->Dest);
|
||||
} else if ($this->_outlineDictionary->A !== null) {
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
return Zend_Pdf_Action::load($this->_outlineDictionary->A);
|
||||
}
|
||||
|
||||
|
@ -16,38 +16,20 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Page.php 17532 2009-08-10 19:04:14Z alexander $
|
||||
* @version $Id: Page.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_Style */
|
||||
require_once 'Zend/Pdf/Style.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/String/Binary.php';
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference */
|
||||
require_once 'Zend/Pdf/Element/Reference.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
/** Zend_Pdf_Color_GrayScale */
|
||||
require_once 'Zend/Pdf/Color/GrayScale.php';
|
||||
|
||||
/** Zend_Pdf_Color_Rgb */
|
||||
require_once 'Zend/Pdf/Color/Rgb.php';
|
||||
|
||||
/** Zend_Pdf_Color_Cmyk */
|
||||
require_once 'Zend/Pdf/Color/Cmyk.php';
|
||||
|
||||
/** Zend_Pdf_Annotation */
|
||||
require_once 'Zend/Pdf/Annotation.php';
|
||||
|
||||
/**
|
||||
* PDF Page
|
||||
@ -279,7 +261,12 @@ class Zend_Pdf_Page
|
||||
} else if (is_string($param1) &&
|
||||
($param2 === null || $param2 instanceof Zend_Pdf_ElementFactory_Interface) &&
|
||||
$param3 === null) {
|
||||
$this->_objFactory = ($param2 !== null)? $param2 : Zend_Pdf_ElementFactory::createFactory(1);
|
||||
if ($param2 !== null) {
|
||||
$this->_objFactory = $param2;
|
||||
} else {
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
$this->_objFactory = Zend_Pdf_ElementFactory::createFactory(1);
|
||||
}
|
||||
$this->_attached = false;
|
||||
$this->_safeGS = true; /** New page created. That's users App responsibility to track GS changes */
|
||||
|
||||
@ -318,7 +305,13 @@ class Zend_Pdf_Page
|
||||
|
||||
} else if (is_numeric($param1) && is_numeric($param2) &&
|
||||
($param3 === null || $param3 instanceof Zend_Pdf_ElementFactory_Interface)) {
|
||||
$this->_objFactory = ($param3 !== null)? $param3 : Zend_Pdf_ElementFactory::createFactory(1);
|
||||
if ($param3 !== null) {
|
||||
$this->_objFactory = $param3;
|
||||
} else {
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
$this->_objFactory = Zend_Pdf_ElementFactory::createFactory(1);
|
||||
}
|
||||
|
||||
$this->_attached = false;
|
||||
$this->_safeGS = true; /** New page created. That's users App responsibility to track GS changes */
|
||||
$pageWidth = $param1;
|
||||
@ -331,6 +324,7 @@ class Zend_Pdf_Page
|
||||
|
||||
$this->_pageDictionary = $this->_objFactory->newObject(new Zend_Pdf_Element_Dictionary());
|
||||
$this->_pageDictionary->Type = new Zend_Pdf_Element_Name('Page');
|
||||
require_once 'Zend/Pdf.php';
|
||||
$this->_pageDictionary->LastModified = new Zend_Pdf_Element_String(Zend_Pdf::pdfDate());
|
||||
$this->_pageDictionary->Resources = new Zend_Pdf_Element_Dictionary();
|
||||
$this->_pageDictionary->MediaBox = new Zend_Pdf_Element_Array();
|
||||
@ -758,6 +752,7 @@ class Zend_Pdf_Page
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
foreach ($fontResourcesUnique as $resourceId => $fontDictionary) {
|
||||
try {
|
||||
require_once 'Zend/Pdf/Resource/Font/Extracted.php';
|
||||
// Try to extract font
|
||||
$extractedFont = new Zend_Pdf_Resource_Font_Extracted($fontDictionary);
|
||||
|
||||
@ -815,6 +810,7 @@ class Zend_Pdf_Page
|
||||
|
||||
try {
|
||||
// Try to extract font
|
||||
require_once 'Zend/Pdf/Resource/Font/Extracted.php';
|
||||
return new Zend_Pdf_Resource_Font_Extracted($fontDictionary);
|
||||
} catch (Zend_Pdf_Exception $e) {
|
||||
if ($e->getMessage() != 'Unsupported font type.') {
|
||||
|
@ -16,56 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Parser.php 17530 2009-08-10 18:47:29Z alexander $
|
||||
* @version $Id: Parser.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_Element_Array */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
|
||||
/** Zend_Pdf_Element_String_Binary */
|
||||
require_once 'Zend/Pdf/Element/String/Binary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Boolean */
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference */
|
||||
require_once 'Zend/Pdf/Element/Reference.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object_Stream */
|
||||
require_once 'Zend/Pdf/Element/Object/Stream.php';
|
||||
|
||||
/** Zend_Pdf_Element_String */
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
/** Zend_Pdf_Element_Null */
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Context */
|
||||
require_once 'Zend/Pdf/Element/Reference/Context.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Table */
|
||||
require_once 'Zend/Pdf/Element/Reference/Table.php';
|
||||
|
||||
/** Zend_Pdf_Trailer_Keeper */
|
||||
require_once 'Zend/Pdf/Trailer/Keeper.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
|
||||
/** Zend_Pdf_StringParser */
|
||||
require_once 'Zend/Pdf/StringParser.php';
|
||||
@ -143,7 +100,9 @@ class Zend_Pdf_Parser
|
||||
{
|
||||
$this->_stringParser->offset = $offset;
|
||||
|
||||
require_once 'Zend/Pdf/Element/Reference/Table.php';
|
||||
$refTable = new Zend_Pdf_Element_Reference_Table();
|
||||
require_once 'Zend/Pdf/Element/Reference/Context.php';
|
||||
$context = new Zend_Pdf_Element_Reference_Context($this->_stringParser, $refTable);
|
||||
$this->_stringParser->setContext($context);
|
||||
|
||||
@ -155,12 +114,14 @@ class Zend_Pdf_Parser
|
||||
$this->_stringParser->skipWhiteSpace();
|
||||
while ( ($nextLexeme = $this->_stringParser->readLexeme()) != 'trailer' ) {
|
||||
if (!ctype_digit($nextLexeme)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross-reference table subheader values must contain only digits.', $this->_stringParser->offset-strlen($nextLexeme)));
|
||||
}
|
||||
$objNum = (int)$nextLexeme;
|
||||
|
||||
$refCount = $this->_stringParser->readLexeme();
|
||||
if (!ctype_digit($refCount)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross-reference table subheader values must contain only digits.', $this->_stringParser->offset-strlen($refCount)));
|
||||
}
|
||||
|
||||
@ -168,6 +129,7 @@ class Zend_Pdf_Parser
|
||||
while ($refCount > 0) {
|
||||
$objectOffset = substr($this->_stringParser->data, $this->_stringParser->offset, 10);
|
||||
if (!ctype_digit($objectOffset)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Offset must contain only digits.', $this->_stringParser->offset));
|
||||
}
|
||||
// Force $objectOffset to be treated as decimal instead of octal number
|
||||
@ -179,13 +141,15 @@ class Zend_Pdf_Parser
|
||||
$objectOffset = substr($objectOffset, $numStart);
|
||||
$this->_stringParser->offset += 10;
|
||||
|
||||
if ( !Zend_Pdf_StringParser::isWhiteSpace(ord( $this->_stringParser->data[$this->_stringParser->offset] )) ) {
|
||||
if (strpos("\x00\t\n\f\r ", $this->_stringParser->data[$this->_stringParser->offset]) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Value separator must be white space.', $this->_stringParser->offset));
|
||||
}
|
||||
$this->_stringParser->offset++;
|
||||
|
||||
$genNumber = substr($this->_stringParser->data, $this->_stringParser->offset, 5);
|
||||
if (!ctype_digit($objectOffset)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Offset must contain only digits.', $this->_stringParser->offset));
|
||||
}
|
||||
// Force $objectOffset to be treated as decimal instead of octal number
|
||||
@ -197,7 +161,8 @@ class Zend_Pdf_Parser
|
||||
$genNumber = substr($genNumber, $numStart);
|
||||
$this->_stringParser->offset += 5;
|
||||
|
||||
if ( !Zend_Pdf_StringParser::isWhiteSpace(ord( $this->_stringParser->data[$this->_stringParser->offset] )) ) {
|
||||
if (strpos("\x00\t\n\f\r ", $this->_stringParser->data[$this->_stringParser->offset]) === false) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Value separator must be white space.', $this->_stringParser->offset));
|
||||
}
|
||||
$this->_stringParser->offset++;
|
||||
@ -223,10 +188,12 @@ class Zend_Pdf_Parser
|
||||
}
|
||||
|
||||
if ( !Zend_Pdf_StringParser::isWhiteSpace(ord( $this->_stringParser->data[$this->_stringParser->offset] )) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Value separator must be white space.', $this->_stringParser->offset));
|
||||
}
|
||||
$this->_stringParser->offset++;
|
||||
if ( !Zend_Pdf_StringParser::isWhiteSpace(ord( $this->_stringParser->data[$this->_stringParser->offset] )) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file cross-reference table syntax error. Offset - 0x%X. Value separator must be white space.', $this->_stringParser->offset));
|
||||
}
|
||||
$this->_stringParser->offset++;
|
||||
@ -239,20 +206,24 @@ class Zend_Pdf_Parser
|
||||
$trailerDictOffset = $this->_stringParser->offset;
|
||||
$trailerDict = $this->_stringParser->readElement();
|
||||
if (!$trailerDict instanceof Zend_Pdf_Element_Dictionary) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Dictionary expected after \'trailer\' keyword.', $trailerDictOffset));
|
||||
}
|
||||
} else {
|
||||
$xrefStream = $this->_stringParser->getObject($offset, $context);
|
||||
|
||||
if (!$xrefStream instanceof Zend_Pdf_Element_Object_Stream) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross-reference stream expected.', $offset));
|
||||
}
|
||||
|
||||
$trailerDict = $xrefStream->dictionary;
|
||||
if ($trailerDict->Type->value != 'XRef') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross-reference stream object must have /Type property assigned to /XRef.', $offset));
|
||||
}
|
||||
if ($trailerDict->W === null || $trailerDict->W->getType() != Zend_Pdf_Element::TYPE_ARRAY) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross reference stream dictionary doesn\'t have W entry or it\'s not an array.', $offset));
|
||||
}
|
||||
|
||||
@ -261,6 +232,7 @@ class Zend_Pdf_Parser
|
||||
$entryField3Size = $trailerDict->W->items[2]->value;
|
||||
|
||||
if ($entryField2Size == 0 || $entryField3Size == 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Wrong W dictionary entry. Only type field of stream entries has default value and could be zero length.', $offset));
|
||||
}
|
||||
|
||||
@ -268,6 +240,7 @@ class Zend_Pdf_Parser
|
||||
|
||||
if ($trailerDict->Index !== null) {
|
||||
if ($trailerDict->Index->getType() != Zend_Pdf_Element::TYPE_ARRAY) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Cross reference stream dictionary Index entry must be an array.', $offset));
|
||||
}
|
||||
$sections = count($trailerDict->Index->items)/2;
|
||||
@ -341,10 +314,12 @@ class Zend_Pdf_Parser
|
||||
|
||||
// $streamOffset . ' ' . strlen($xrefStreamData) . "\n";
|
||||
// "$entries\n";
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Cross-reference streams are not supported yet.');
|
||||
}
|
||||
|
||||
|
||||
require_once 'Zend/Pdf/Trailer/Keeper.php';
|
||||
$trailerObj = new Zend_Pdf_Trailer_Keeper($trailerDict, $context);
|
||||
if ($trailerDict->Prev instanceof Zend_Pdf_Element_Numeric ||
|
||||
$trailerDict->Prev instanceof Zend_Pdf_Element_Reference ) {
|
||||
@ -388,6 +363,7 @@ class Zend_Pdf_Parser
|
||||
{
|
||||
if ($load) {
|
||||
if (($pdfFile = @fopen($source, 'rb')) === false ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception( "Can not open '$source' file for reading." );
|
||||
}
|
||||
|
||||
@ -408,6 +384,7 @@ class Zend_Pdf_Parser
|
||||
|
||||
$pdfVersionComment = $this->_stringParser->readComment();
|
||||
if (substr($pdfVersionComment, 0, 5) != '%PDF-') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('File is not a PDF.');
|
||||
}
|
||||
|
||||
@ -421,6 +398,7 @@ class Zend_Pdf_Parser
|
||||
* Stream compression filter must be implemented (for compressed object streams).
|
||||
* Cross reference streams must be implemented
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('Unsupported PDF version. Zend_Pdf supports PDF 1.0-1.4. Current version - \'%f\'', $pdfVersion));
|
||||
}
|
||||
$this->_pdfVersion = $pdfVersion;
|
||||
@ -428,6 +406,7 @@ class Zend_Pdf_Parser
|
||||
$this->_stringParser->offset = strrpos($this->_stringParser->data, '%%EOF');
|
||||
if ($this->_stringParser->offset === false ||
|
||||
strlen($this->_stringParser->data) - $this->_stringParser->offset > 7) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Pdf file syntax error. End-of-fle marker expected at the end of file.');
|
||||
}
|
||||
|
||||
@ -460,11 +439,13 @@ class Zend_Pdf_Parser
|
||||
|
||||
$nextLexeme = $this->_stringParser->readLexeme();
|
||||
if ($nextLexeme != 'startxref') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('Pdf file syntax error. \'startxref\' keyword expected. Offset - 0x%X.', $this->_stringParser->offset-strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
$startXref = $this->_stringParser->readLexeme();
|
||||
if (!ctype_digit($startXref)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('Pdf file syntax error. Cross-reference table offset must contain only digits. Offset - 0x%X.', $this->_stringParser->offset-strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
|
@ -16,20 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Resource.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Resource.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file Resource abstraction
|
||||
*
|
||||
@ -76,6 +66,8 @@ abstract class Zend_Pdf_Resource
|
||||
*/
|
||||
public function __construct($resource)
|
||||
{
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
$this->_objectFactory = Zend_Pdf_ElementFactory::createFactory(1);
|
||||
if ($resource instanceof Zend_Pdf_Element) {
|
||||
$this->_resource = $this->_objectFactory->newObject($resource);
|
||||
@ -107,4 +99,3 @@ abstract class Zend_Pdf_Resource
|
||||
return $this->_objectFactory;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,12 +17,20 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Font.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Font.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Resource */
|
||||
require_once 'Zend/Pdf/Resource.php';
|
||||
|
||||
/**
|
||||
* Zend_Pdf_Font
|
||||
*
|
||||
* Zend_Pdf_Font class constants are used within Zend_Pdf_Resource_Font
|
||||
* and its subclusses.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Font.php';
|
||||
|
||||
/**
|
||||
* Abstract class which manages PDF fonts.
|
||||
*
|
||||
|
@ -17,35 +17,35 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CidFont.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: CidFont.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
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_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adobe PDF CIDFont font object implementation
|
||||
*
|
||||
*
|
||||
* A CIDFont program contains glyph descriptions that are accessed using a CID as
|
||||
* the character selector. There are two types of CIDFont. A Type 0 CIDFont contains
|
||||
* glyph descriptions based on Adobe’s Type 1 font format, whereas those in a
|
||||
* Type 2 CIDFont are based on the TrueType font format.
|
||||
*
|
||||
* A CIDFont dictionary is a PDF object that contains information about a CIDFont program.
|
||||
* Although its Type value is Font, a CIDFont is not actually a font. It does not have an Encoding
|
||||
* entry, it cannot be listed in the Font subdictionary of a resource dictionary, and it cannot be
|
||||
* used as the operand of the Tf operator. It is used only as a descendant of a Type 0 font.
|
||||
* The CMap in the Type 0 font is what defines the encoding that maps character codes to CIDs
|
||||
* in the CIDFont.
|
||||
*
|
||||
* A CIDFont dictionary is a PDF object that contains information about a CIDFont program.
|
||||
* Although its Type value is Font, a CIDFont is not actually a font. It does not have an Encoding
|
||||
* entry, it cannot be listed in the Font subdictionary of a resource dictionary, and it cannot be
|
||||
* used as the operand of the Tf operator. It is used only as a descendant of a Type 0 font.
|
||||
* The CMap in the Type 0 font is what defines the encoding that maps character codes to CIDs
|
||||
* in the CIDFont.
|
||||
*
|
||||
* Font objects should be normally be obtained from the factory methods
|
||||
* {@link Zend_Pdf_Font::fontWithName} and {@link Zend_Pdf_Font::fontWithPath}.
|
||||
*
|
||||
@ -71,11 +71,11 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* Width for characters missed in the font
|
||||
*
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_missingCharWidth = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
@ -90,7 +90,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
parent::__construct();
|
||||
|
||||
$fontParser->parse();
|
||||
|
||||
|
||||
|
||||
/* Object properties */
|
||||
|
||||
@ -132,7 +132,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
$charWidths[$charCode] = $glyphWidths[$glyph];
|
||||
}
|
||||
$this->_charWidths = $charWidths;
|
||||
$this->_missingCharWidth = $glyphWidths[0];
|
||||
$this->_missingCharWidth = $glyphWidths[0];
|
||||
|
||||
/* Width array optimization. Step1: extract default value */
|
||||
$widthFrequencies = array_count_values($charWidths);
|
||||
@ -147,12 +147,12 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
|
||||
// Store default value in the font dictionary
|
||||
$this->_resource->DW = new Zend_Pdf_Element_Numeric($this->toEmSpace($defaultWidth));
|
||||
|
||||
|
||||
// Remove characters which corresponds to default width from the widths array
|
||||
$defWidthChars = array_keys($charWidths, $defaultWidth);
|
||||
foreach ($defWidthChars as $charCode) {
|
||||
unset($charWidths[$charCode]);
|
||||
}
|
||||
}
|
||||
|
||||
// Order cheracter widths aray by character codes
|
||||
ksort($charWidths, SORT_NUMERIC);
|
||||
@ -166,7 +166,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
$sequenceStartCode = $charCode;
|
||||
} else if ($charCode != $lastCharCode + 1) {
|
||||
// New chracters sequence detected
|
||||
$widthsSequences[$sequenceStartCode] = $charCodesSequense;
|
||||
$widthsSequences[$sequenceStartCode] = $charCodesSequense;
|
||||
$charCodesSequense = array();
|
||||
$sequenceStartCode = $charCode;
|
||||
}
|
||||
@ -176,7 +176,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
// Save last sequence, if widths array is not empty (it may happens for monospaced fonts)
|
||||
if (count($charWidths) != 0) {
|
||||
$widthsSequences[$sequenceStartCode] = $charCodesSequense;
|
||||
}
|
||||
}
|
||||
|
||||
$pdfCharsWidths = array();
|
||||
foreach ($widthsSequences as $startCode => $widthsSequence) {
|
||||
@ -191,7 +191,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
// Previous width value was a part of the widths sequence. Save it as 'c_1st c_last w'.
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode); // First character code
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode + $widthsInSequence - 1); // Last character code
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth)); // Width
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth)); // Width
|
||||
|
||||
// Reset widths sequence
|
||||
$startCode = $startCode + $widthsInSequence;
|
||||
@ -205,13 +205,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
} else {
|
||||
// Width is equal to previous
|
||||
if (count($pdfWidths) != 0) {
|
||||
// We already have some widths collected
|
||||
// We already have some widths collected
|
||||
// So, we've just detected new widths sequence
|
||||
|
||||
|
||||
// Remove last element from widths list, since it's a part of widths sequence
|
||||
array_pop($pdfWidths);
|
||||
|
||||
// and write the rest if it's not empty
|
||||
// and write the rest if it's not empty
|
||||
if (count($pdfWidths) != 0) {
|
||||
// Save it as 'c_1st [w1 w2 ... wn]'.
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode); // First character code
|
||||
@ -241,7 +241,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
// Save it as 'c_1st c_last w'.
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode); // First character code
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode + $widthsInSequence - 1); // Last character code
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth)); // Width
|
||||
$pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth)); // Width
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
$widthsObject = $this->_objectFactory->newObject($widthsArrayElement);
|
||||
$this->_resource->W = $widthsObject;
|
||||
|
||||
|
||||
|
||||
/* CIDSystemInfo dictionary */
|
||||
$cidSystemInfo = new Zend_Pdf_Element_Dictionary();
|
||||
$cidSystemInfo->Registry = new Zend_Pdf_Element_String('Adobe');
|
||||
@ -262,8 +262,8 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
$this->_resource->CIDSystemInfo = $cidSystemInfoObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
@ -278,12 +278,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function glyphNumbersForCharacters($characterCodes)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
|
||||
@ -302,12 +303,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function glyphNumberForCharacter($characterCode)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
|
||||
@ -401,7 +403,7 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
}
|
||||
return $this->_charWidths[$charCode];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the widths of the glyphs.
|
||||
*
|
||||
@ -412,12 +414,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function widthsForGlyphs($glyphNumbers)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
|
||||
@ -433,12 +436,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function widthForGlyph($glyphNumber)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
|
||||
@ -453,12 +457,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function encodeString($string, $charEncoding)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
|
||||
@ -473,12 +478,13 @@ abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
|
||||
public function decodeString($string, $charEncoding)
|
||||
{
|
||||
/**
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* CIDFont object is not actually a font. It does not have an Encoding entry,
|
||||
* it cannot be listed in the Font subdictionary of a resource dictionary, and
|
||||
* it cannot be used as the operand of the Tf operator.
|
||||
*
|
||||
*
|
||||
* Throw an exception.
|
||||
*/
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
|
||||
}
|
||||
}
|
||||
|
@ -17,16 +17,21 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrueType.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TrueType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Resource_Font_CidFont */
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont.php';
|
||||
|
||||
/** Internally used classes */
|
||||
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_FontDescriptor */
|
||||
require_once 'Zend/Pdf/Resource/Font/FontDescriptor.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_CidFont */
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont.php';
|
||||
|
||||
/**
|
||||
* Type 2 CIDFonts implementation
|
||||
*
|
||||
@ -46,8 +51,8 @@ class Zend_Pdf_Resource_Font_CidFont_TrueType extends Zend_Pdf_Resource_Font_Cid
|
||||
{
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
* @todo Joing this class with Zend_Pdf_Resource_Font_Simple_Parsed_TrueType
|
||||
*
|
||||
* @todo Joing this class with Zend_Pdf_Resource_Font_Simple_Parsed_TrueType
|
||||
*
|
||||
* @param Zend_Pdf_FileParser_Font_OpenType_TrueType $fontParser Font parser
|
||||
* object containing parsed TrueType file.
|
||||
@ -61,7 +66,7 @@ class Zend_Pdf_Resource_Font_CidFont_TrueType extends Zend_Pdf_Resource_Font_Cid
|
||||
$this->_fontType = Zend_Pdf_Font::TYPE_CIDFONT_TYPE_2;
|
||||
|
||||
$this->_resource->Subtype = new Zend_Pdf_Element_Name('CIDFontType2');
|
||||
|
||||
|
||||
$fontDescriptor = Zend_Pdf_Resource_Font_FontDescriptor::factory($this, $fontParser, $embeddingOptions);
|
||||
$this->_resource->FontDescriptor = $this->_objectFactory->newObject($fontDescriptor);
|
||||
|
||||
|
@ -17,17 +17,13 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Extracted.php 17530 2009-08-10 18:47:29Z alexander $
|
||||
* @version $Id: Extracted.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Extracted fonts implementation
|
||||
*
|
||||
@ -73,6 +69,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
// Composite type 0 font
|
||||
if (count($fontDictionary->DescendantFonts->items) != 1) {
|
||||
// Multiple descendant fonts are not supported
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported font type.');
|
||||
}
|
||||
|
||||
@ -111,6 +108,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
break;
|
||||
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Unsupported font type.');
|
||||
}
|
||||
|
||||
@ -142,6 +140,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
*/
|
||||
public function glyphNumbersForCharacters($characterCodes)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
|
||||
}
|
||||
|
||||
@ -159,6 +158,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
*/
|
||||
public function glyphNumberForCharacter($characterCode)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
|
||||
}
|
||||
|
||||
@ -182,6 +182,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
*/
|
||||
public function getCoveredPercentage($string, $charEncoding = '')
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
|
||||
}
|
||||
|
||||
@ -199,6 +200,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
*/
|
||||
public function widthsForGlyphs($glyphNumbers)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
|
||||
}
|
||||
|
||||
@ -213,6 +215,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
*/
|
||||
public function widthForGlyph($glyphNumber)
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Operation is not supported for extracted fonts');
|
||||
}
|
||||
|
||||
@ -235,6 +238,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
return iconv($charEncoding, 'CP1252//IGNORE', $string);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Fonf encoding is not supported');
|
||||
}
|
||||
|
||||
@ -257,6 +261,7 @@ class Zend_Pdf_Resource_Font_Extracted extends Zend_Pdf_Resource_Font
|
||||
return iconv('CP1252', $charEncoding, $string);
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Fonf encoding is not supported');
|
||||
}
|
||||
}
|
||||
|
@ -17,23 +17,24 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: FontDescriptor.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: FontDescriptor.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
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_Font */
|
||||
require_once 'Zend/Pdf/Font.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
|
||||
/**
|
||||
* FontDescriptor implementation
|
||||
*
|
||||
* A font descriptor specifies metrics and other attributes of a simple font or a
|
||||
* A font descriptor specifies metrics and other attributes of a simple font or a
|
||||
* CIDFont as a whole, as distinct from the metrics of individual glyphs. These font
|
||||
* metrics provide information that enables a viewer application to synthesize a
|
||||
* substitute font or select a similar font when the font program is unavailable. The
|
||||
@ -52,12 +53,13 @@ class Zend_Pdf_Resource_Font_FontDescriptor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('Zend_Pdf_Resource_Font_FontDescriptor is not intended to be instantiated');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Object constructor
|
||||
*
|
||||
*
|
||||
* The $embeddingOptions parameter allows you to set certain flags related
|
||||
* to font embedding. You may combine options by OR-ing them together. See
|
||||
* the EMBED_ constants defined in {@link Zend_Pdf_Font} for the list of
|
||||
@ -67,8 +69,8 @@ class Zend_Pdf_Resource_Font_FontDescriptor
|
||||
* to use them. If the recipient of the PDF has the font installed on their
|
||||
* computer, they will see the correct fonts in the document. If they don't,
|
||||
* the PDF viewer will substitute or synthesize a replacement.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param Zend_Pdf_Resource_Font $font Font
|
||||
* @param Zend_Pdf_FileParser_Font_OpenType $fontParser Font parser object containing parsed TrueType file.
|
||||
* @param integer $embeddingOptions Options for font embedding.
|
||||
@ -129,7 +131,7 @@ class Zend_Pdf_Resource_Font_FontDescriptor
|
||||
* @todo Calculate value for StemV.
|
||||
*/
|
||||
$fontDescriptor->StemV = new Zend_Pdf_Element_Numeric(0);
|
||||
|
||||
|
||||
$fontDescriptor->MissingWidth = new Zend_Pdf_Element_Numeric($fontParser->glyphWidths[0]);
|
||||
|
||||
/* Set up font embedding. This is where the actual font program itself
|
||||
@ -164,6 +166,7 @@ class Zend_Pdf_Resource_Font_FontDescriptor
|
||||
$message = 'This font cannot be embedded in the PDF document. If you would like to use '
|
||||
. 'it anyway, you must pass Zend_Pdf_Font::EMBED_SUPPRESS_EMBED_EXCEPTION '
|
||||
. 'in the $options parameter of the font constructor.';
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception($message, Zend_Pdf_Exception::FONT_CANT_BE_EMBEDDED);
|
||||
}
|
||||
|
||||
|
@ -17,21 +17,21 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Simple.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Simple.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_Cmap */
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adobe PDF Simple fonts implementation
|
||||
*
|
||||
* PDF simple fonts functionality is presented by Adobe Type 1
|
||||
*
|
||||
* PDF simple fonts functionality is presented by Adobe Type 1
|
||||
* (including standard PDF Type1 built-in fonts) and TrueType fonts support.
|
||||
*
|
||||
* Both fonts have the following properties:
|
||||
@ -40,17 +40,17 @@ require_once 'Zend/Pdf/Cmap.php';
|
||||
* into a table of 256 glyphs; the mapping from codes to glyphs is called the font’s
|
||||
* encoding.
|
||||
* PDF specification provides a possibility to specify any user defined encoding in addition
|
||||
* to the standard built-in encodings: Standard-Encoding, MacRomanEncoding, WinAnsiEncoding,
|
||||
* and PDFDocEncoding, but Zend_Pdf simple fonts implementation operates only with
|
||||
* to the standard built-in encodings: Standard-Encoding, MacRomanEncoding, WinAnsiEncoding,
|
||||
* and PDFDocEncoding, but Zend_Pdf simple fonts implementation operates only with
|
||||
* Windows ANSI encoding (except Symbol and ZapfDingbats built-in fonts).
|
||||
*
|
||||
* - Each glyph has a single set of metrics, including a horizontal displacement or
|
||||
* width. That is, simple fonts support only horizontal writing mode.
|
||||
*
|
||||
*
|
||||
*
|
||||
* The code in this class is common to both types. However, you will only deal
|
||||
* directly with subclasses.
|
||||
*
|
||||
*
|
||||
* Font objects should be normally be obtained from the factory methods
|
||||
* {@link Zend_Pdf_Font::fontWithName} and {@link Zend_Pdf_Font::fontWithPath}.
|
||||
*
|
||||
@ -81,12 +81,12 @@ abstract class Zend_Pdf_Resource_Font_Simple extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* Width for glyphs missed in the font
|
||||
*
|
||||
*
|
||||
* Note: Adobe PDF specfication (V1.4 - V1.6) doesn't define behavior for rendering
|
||||
* characters missed in the standard PDF fonts (such us 0x7F (DEL) Windows ANSI code)
|
||||
* Adobe Font Metrics files doesn't also define metrics for "missed glyph".
|
||||
* We provide character width as "0" for this case, but actually it depends on PDF viewer
|
||||
* implementation.
|
||||
* implementation.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
@ -108,13 +108,13 @@ abstract class Zend_Pdf_Resource_Font_Simple extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* @todo
|
||||
* It's easy to add other encodings support now (Standard-Encoding, MacRomanEncoding,
|
||||
* It's easy to add other encodings support now (Standard-Encoding, MacRomanEncoding,
|
||||
* PDFDocEncoding, MacExpertEncoding, Symbol, and ZapfDingbats).
|
||||
* Steps for the implementation:
|
||||
* - completely describe all PDF single byte encodings in the documentation
|
||||
* - implement non-WinAnsi encodings processing into encodeString()/decodeString() methods
|
||||
*
|
||||
* These encodings will be automatically supported for standard builtin PDF fonts as well
|
||||
*
|
||||
* These encodings will be automatically supported for standard builtin PDF fonts as well
|
||||
* as for external fonts.
|
||||
*/
|
||||
$this->_resource->Encoding = new Zend_Pdf_Element_Name('WinAnsiEncoding');
|
||||
@ -251,8 +251,8 @@ abstract class Zend_Pdf_Resource_Font_Simple extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* Convert string to the font encoding.
|
||||
*
|
||||
* The method is used to prepare string for text drawing operators
|
||||
*
|
||||
* The method is used to prepare string for text drawing operators
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $charEncoding Character encoding of source text.
|
||||
@ -263,7 +263,7 @@ abstract class Zend_Pdf_Resource_Font_Simple extends Zend_Pdf_Resource_Font
|
||||
if (PHP_OS == 'AIX') {
|
||||
return $string; // returning here b/c AIX doesnt know what CP1252 is
|
||||
}
|
||||
|
||||
|
||||
return iconv($charEncoding, 'CP1252//IGNORE', $string);
|
||||
}
|
||||
|
||||
|
@ -17,16 +17,19 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Parsed.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Parsed.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** 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_Resource_Font_Simple */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple.php';
|
||||
|
||||
/** Zend_Pdf_FileParser_Font_OpenType */
|
||||
require_once 'Zend/Pdf/FileParser/Font/OpenType.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parsed and (optionaly) embedded fonts implementation
|
||||
*
|
||||
@ -48,8 +51,8 @@ abstract class Zend_Pdf_Resource_Font_Simple_Parsed extends Zend_Pdf_Resource_Fo
|
||||
public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
|
||||
|
||||
$fontParser->parse();
|
||||
|
||||
/* Object properties */
|
||||
@ -99,5 +102,4 @@ abstract class Zend_Pdf_Resource_Font_Simple_Parsed extends Zend_Pdf_Resource_Fo
|
||||
$widthsObject = $this->_objectFactory->newObject($widthsArrayElement);
|
||||
$this->_resource->Widths = $widthsObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,16 +17,19 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TrueType.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: TrueType.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Parsed */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Parsed.php';
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_FontDescriptor */
|
||||
require_once 'Zend/Pdf/Resource/Font/FontDescriptor.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Parsed */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Parsed.php';
|
||||
|
||||
/**
|
||||
* TrueType fonts implementation
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Standard.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Standard.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple.php';
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class definition for the standard 14 Type 1 PDF fonts.
|
||||
*
|
||||
@ -75,5 +79,4 @@ abstract class Zend_Pdf_Resource_Font_Simple_Standard extends Zend_Pdf_Resource_
|
||||
parent::__construct();
|
||||
$this->_resource->Subtype = new Zend_Pdf_Element_Name('Type1');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Courier.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Courier.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Courier.
|
||||
*
|
||||
@ -275,8 +279,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Courier extends Zend_Pdf_Resource_F
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -287,5 +292,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Courier extends Zend_Pdf_Resource_F
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Courier');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CourierBold.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: CourierBold.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Courier-Bold.
|
||||
*
|
||||
@ -276,8 +280,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierBold extends Zend_Pdf_Resour
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -288,5 +293,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierBold extends Zend_Pdf_Resour
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Courier-Bold');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CourierBoldOblique.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: CourierBoldOblique.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Courier-BoldOblique.
|
||||
*
|
||||
@ -277,8 +281,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierBoldOblique extends Zend_Pdf
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -289,5 +294,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierBoldOblique extends Zend_Pdf
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Courier-BoldOblique');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: CourierOblique.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: CourierOblique.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Courier-Oblique.
|
||||
*
|
||||
@ -277,8 +281,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierOblique extends Zend_Pdf_Res
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -289,5 +294,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_CourierOblique extends Zend_Pdf_Res
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Courier-Oblique');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Helvetica.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Helvetica.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Helvetica.
|
||||
*
|
||||
@ -285,8 +289,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Helvetica extends Zend_Pdf_Resource
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -297,5 +302,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Helvetica extends Zend_Pdf_Resource
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Helvetica');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,16 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HelveticaBold.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: HelveticaBold.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Helvetica-Bold.
|
||||
*
|
||||
@ -286,8 +289,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBold extends Zend_Pdf_Reso
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -298,5 +302,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBold extends Zend_Pdf_Reso
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Helvetica-Bold');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HelveticaBoldOblique.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: HelveticaBoldOblique.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Helvetica-BoldOblique.
|
||||
*
|
||||
@ -288,8 +292,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBoldOblique extends Zend_P
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -300,5 +305,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaBoldOblique extends Zend_P
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Helvetica-BoldOblique');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: HelveticaOblique.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: HelveticaOblique.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Helvetica-Oblique.
|
||||
*
|
||||
@ -287,8 +291,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaOblique extends Zend_Pdf_R
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -299,5 +304,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_HelveticaOblique extends Zend_Pdf_R
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Helvetica-Oblique');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Symbol.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Symbol.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Symbol.
|
||||
*
|
||||
@ -342,8 +346,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Symbol extends Zend_Pdf_Resource_Fo
|
||||
0xf8f6 => 0xb5, 0xf8f7 => 0xb6, 0xf8f8 => 0xb7, 0xf8f9 => 0xb8,
|
||||
0xf8fa => 0xb9, 0xf8fb => 0xba, 0xf8fc => 0xbb, 0xf8fd => 0xbc,
|
||||
0xf8fe => 0xbd, 0xf8ff => 0xbe);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -457,5 +462,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_Symbol extends Zend_Pdf_Resource_Fo
|
||||
}
|
||||
return $this->decodeString($string, 'UTF-16BE');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TimesBold.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TimesBold.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Times-Bold.
|
||||
*
|
||||
@ -284,8 +288,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesBold extends Zend_Pdf_Resource
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -296,5 +301,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesBold extends Zend_Pdf_Resource
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Times-Bold');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TimesBoldItalic.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TimesBoldItalic.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Times-BoldItalic.
|
||||
*
|
||||
@ -285,8 +289,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesBoldItalic extends Zend_Pdf_Re
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -297,5 +302,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesBoldItalic extends Zend_Pdf_Re
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Times-BoldItalic');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TimesItalic.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TimesItalic.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Times-Italic.
|
||||
*
|
||||
@ -285,8 +289,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesItalic extends Zend_Pdf_Resour
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -297,5 +302,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesItalic extends Zend_Pdf_Resour
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Times-Italic');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: TimesRoman.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: TimesRoman.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font Times-Roman.
|
||||
*
|
||||
@ -285,8 +289,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesRoman extends Zend_Pdf_Resourc
|
||||
0xac => 0x0131, 0xf6 => 0x0132, 0xfc => 0x0133, 0x2260 => 0x0134,
|
||||
0x0123 => 0x0135, 0xf0 => 0x0136, 0x017e => 0x0137, 0x0146 => 0x0138,
|
||||
0xb9 => 0x0139, 0x012b => 0x013a, 0x20ac => 0x013b);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -297,5 +302,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_TimesRoman extends Zend_Pdf_Resourc
|
||||
*/
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name('Times-Roman');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,17 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ZapfDingbats.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: ZapfDingbats.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font_Simple_Standard */
|
||||
require_once 'Zend/Pdf/Resource/Font/Simple/Standard.php';
|
||||
|
||||
|
||||
/**
|
||||
* Implementation for the standard PDF font ZapfDingbats.
|
||||
*
|
||||
@ -368,8 +372,9 @@ class Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats extends Zend_Pdf_Resou
|
||||
0x27b5 => 0xc1, 0x27b6 => 0xc2, 0x27b7 => 0xc3, 0x27b8 => 0xc4,
|
||||
0x27b9 => 0xc5, 0x27ba => 0xc6, 0x27bb => 0xc7, 0x27bc => 0xc8,
|
||||
0x27bd => 0xc9, 0x27be => 0xca);
|
||||
require_once 'Zend/Pdf/Cmap.php';
|
||||
$this->_cmap = Zend_Pdf_Cmap::cmapWithTypeData(
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
Zend_Pdf_Cmap::TYPE_BYTE_ENCODING_STATIC, $cmapData);
|
||||
|
||||
|
||||
/* Resource dictionary */
|
||||
@ -483,5 +488,4 @@ class Zend_Pdf_Resource_Font_Simple_Standard_ZapfDingbats extends Zend_Pdf_Resou
|
||||
}
|
||||
return $this->decodeString($string, 'UTF-16BE');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,42 +17,41 @@
|
||||
* @subpackage Fonts
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Type0.php 16971 2009-07-22 18:05:45Z mikaelkael $
|
||||
* @version $Id: Type0.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_CidFont */
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font_CidFont_TrueType */
|
||||
require_once 'Zend/Pdf/Resource/Font/CidFont/TrueType.php';
|
||||
|
||||
|
||||
/**
|
||||
* Adobe PDF composite fonts implementation
|
||||
*
|
||||
*
|
||||
* A composite font is one whose glyphs are obtained from other fonts or from fontlike
|
||||
* objects called CIDFonts ({@link Zend_Pdf_Resource_Font_CidFont}), organized hierarchically.
|
||||
* In PDF, a composite font is represented by a font dictionary whose Subtype value is Type0;
|
||||
* this is also called a Type 0 font (the Type 0 font at the top level of the hierarchy is the
|
||||
* In PDF, a composite font is represented by a font dictionary whose Subtype value is Type0;
|
||||
* this is also called a Type 0 font (the Type 0 font at the top level of the hierarchy is the
|
||||
* root font).
|
||||
*
|
||||
*
|
||||
* In PDF, a Type 0 font is a CID-keyed font.
|
||||
*
|
||||
* CID-keyed fonts provide effective method to operate with multi-byte character encodings.
|
||||
*
|
||||
* The CID-keyed font architecture specifies the external representation of certain font programs,
|
||||
*
|
||||
* The CID-keyed font architecture specifies the external representation of certain font programs,
|
||||
* called CMap and CIDFont files, along with some conventions for combining and using those files.
|
||||
*
|
||||
* A CID-keyed font is the combination of a CMap with one or more CIDFonts, simple fonts,
|
||||
*
|
||||
* A CID-keyed font is the combination of a CMap with one or more CIDFonts, simple fonts,
|
||||
* or composite fonts containing glyph descriptions.
|
||||
*
|
||||
*
|
||||
* The term 'CID-keyed font' reflects the fact that CID (character identifier) numbers
|
||||
* are used to index and access the glyph descriptions in the font.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Font objects should be normally be obtained from the factory methods
|
||||
* {@link Zend_Pdf_Font::fontWithName} and {@link Zend_Pdf_Font::fontWithPath}.
|
||||
*
|
||||
@ -65,7 +64,7 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
{
|
||||
/**
|
||||
* Descendant CIDFont
|
||||
*
|
||||
*
|
||||
* @var Zend_Pdf_Resource_Font_CidFont
|
||||
*/
|
||||
private $_descendantFont;
|
||||
@ -73,7 +72,7 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* Generate ToUnicode character map data
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static private function getToUnicodeCMapData()
|
||||
@ -107,9 +106,9 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
public function __construct(Zend_Pdf_Resource_Font_CidFont $descendantFont)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
||||
$this->_objectFactory->attach($descendantFont->getFactory());
|
||||
|
||||
|
||||
$this->_fontType = Zend_Pdf_Font::TYPE_TYPE_0;
|
||||
$this->_descendantFont = $descendantFont;
|
||||
|
||||
@ -130,23 +129,23 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
$this->_ascent = $descendantFont->getAscent();
|
||||
$this->_descent = $descendantFont->getDescent();
|
||||
$this->_lineGap = $descendantFont->getLineGap();
|
||||
|
||||
|
||||
|
||||
|
||||
$this->_resource->Subtype = new Zend_Pdf_Element_Name('Type0');
|
||||
$this->_resource->BaseFont = new Zend_Pdf_Element_Name($descendantFont->getResource()->BaseFont->value);
|
||||
$this->_resource->DescendantFonts = new Zend_Pdf_Element_Array(array( $descendantFont->getResource() ));
|
||||
$this->_resource->Encoding = new Zend_Pdf_Element_Name('Identity-H');
|
||||
|
||||
|
||||
$toUnicode = $this->_objectFactory->newStreamObject(self::getToUnicodeCMapData());
|
||||
$this->_resource->ToUnicode = $toUnicode;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of glyph numbers corresponding to the Unicode characters.
|
||||
*
|
||||
* Zend_Pdf uses 'Identity-H' encoding for Type 0 fonts.
|
||||
* So we don't need to perform any conversion
|
||||
* So we don't need to perform any conversion
|
||||
*
|
||||
* See also {@link glyphNumberForCharacter()}.
|
||||
*
|
||||
@ -162,7 +161,7 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
* Returns the glyph number corresponding to the Unicode character.
|
||||
*
|
||||
* Zend_Pdf uses 'Identity-H' encoding for Type 0 fonts.
|
||||
* So we don't need to perform any conversion
|
||||
* So we don't need to perform any conversion
|
||||
*
|
||||
* @param integer $characterCode Unicode character code (code point).
|
||||
* @return integer Glyph number.
|
||||
@ -171,7 +170,7 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
{
|
||||
return $characterCode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a number between 0 and 1 inclusive that indicates the percentage
|
||||
* of characters in the string which are covered by glyphs in this font.
|
||||
@ -230,8 +229,8 @@ class Zend_Pdf_Resource_Font_Type0 extends Zend_Pdf_Resource_Font
|
||||
|
||||
/**
|
||||
* Convert string to the font encoding.
|
||||
*
|
||||
* The method is used to prepare string for text drawing operators
|
||||
*
|
||||
* The method is used to prepare string for text drawing operators
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $charEncoding Character encoding of source text.
|
||||
|
@ -16,19 +16,16 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Image.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Image.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
/** Internally used classes */
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource */
|
||||
require_once 'Zend/Pdf/Resource.php';
|
||||
|
||||
|
@ -16,20 +16,18 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Jpeg.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Jpeg.php 19039 2009-11-19 15:05:32Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Image */
|
||||
require_once 'Zend/Pdf/Resource/Image.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
|
||||
/**
|
||||
* JPEG image
|
||||
*
|
||||
@ -58,7 +56,8 @@ class Zend_Pdf_Resource_Image_Jpeg extends Zend_Pdf_Resource_Image
|
||||
}
|
||||
|
||||
$gd_options = gd_info();
|
||||
if (!$gd_options['JPG Support'] ) {
|
||||
if ( (!isset($gd_options['JPG Support']) || $gd_options['JPG Support'] != true) &&
|
||||
(!isset($gd_options['JPEG Support']) || $gd_options['JPEG Support'] != true) ) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception('JPG support is not configured properly.');
|
||||
}
|
||||
|
@ -16,21 +16,21 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Png.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Png.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Internally used classes */
|
||||
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/Binary.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Resource_Image */
|
||||
require_once 'Zend/Pdf/Resource/Image.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
/**
|
||||
* PNG image
|
||||
*
|
||||
@ -149,20 +149,27 @@ class Zend_Pdf_Resource_Image_Png extends Zend_Pdf_Resource_Image
|
||||
switch ($color) {
|
||||
case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_GRAY:
|
||||
$baseColor = ord(substr($trnsData, 1, 1));
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($baseColor), new Zend_Pdf_Element_Numeric($baseColor));
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($baseColor),
|
||||
new Zend_Pdf_Element_Numeric($baseColor));
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_RGB:
|
||||
$red = ord(substr($trnsData,1,1));
|
||||
$green = ord(substr($trnsData,3,1));
|
||||
$blue = ord(substr($trnsData,5,1));
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($red), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($green), new Zend_Pdf_Element_Numeric($blue), new Zend_Pdf_Element_Numeric($blue));
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($red),
|
||||
new Zend_Pdf_Element_Numeric($red),
|
||||
new Zend_Pdf_Element_Numeric($green),
|
||||
new Zend_Pdf_Element_Numeric($green),
|
||||
new Zend_Pdf_Element_Numeric($blue),
|
||||
new Zend_Pdf_Element_Numeric($blue));
|
||||
break;
|
||||
|
||||
case Zend_Pdf_Resource_Image_Png::PNG_CHANNEL_INDEXED:
|
||||
//Find the first transparent color in the index, we will mask that. (This is a bit of a hack. This should be a SMask and mask all entries values).
|
||||
if(($trnsIdx = strpos($trnsData, chr(0))) !== false) {
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($trnsIdx), new Zend_Pdf_Element_Numeric($trnsIdx));
|
||||
$transparencyData = array(new Zend_Pdf_Element_Numeric($trnsIdx),
|
||||
new Zend_Pdf_Element_Numeric($trnsIdx));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -225,6 +232,7 @@ class Zend_Pdf_Resource_Image_Png extends Zend_Pdf_Resource_Image
|
||||
|
||||
$colorSpace = new Zend_Pdf_Element_Name('DeviceGray');
|
||||
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
$decodingObjFactory = Zend_Pdf_ElementFactory::createFactory(1);
|
||||
$decodingStream = $decodingObjFactory->newStreamObject($imageData);
|
||||
$decodingStream->dictionary->Filter = new Zend_Pdf_Element_Name('FlateDecode');
|
||||
@ -259,6 +267,7 @@ class Zend_Pdf_Resource_Image_Png extends Zend_Pdf_Resource_Image
|
||||
|
||||
$colorSpace = new Zend_Pdf_Element_Name('DeviceRGB');
|
||||
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
$decodingObjFactory = Zend_Pdf_ElementFactory::createFactory(1);
|
||||
$decodingStream = $decodingObjFactory->newStreamObject($imageData);
|
||||
$decodingStream->dictionary->Filter = new Zend_Pdf_Element_Name('FlateDecode');
|
||||
@ -297,11 +306,11 @@ class Zend_Pdf_Resource_Image_Png extends Zend_Pdf_Resource_Image
|
||||
* Includes the Alpha transparency data as a Gray Image, then assigns the image as the Shadow Mask for the main image data.
|
||||
*/
|
||||
$smaskStream = $this->_objectFactory->newStreamObject($smaskData);
|
||||
$smaskStream->dictionary->Type = new Zend_Pdf_Element_Name('XObject');
|
||||
$smaskStream->dictionary->Subtype = new Zend_Pdf_Element_Name('Image');
|
||||
$smaskStream->dictionary->Width = new Zend_Pdf_Element_Numeric($width);
|
||||
$smaskStream->dictionary->Height = new Zend_Pdf_Element_Numeric($height);
|
||||
$smaskStream->dictionary->ColorSpace = new Zend_Pdf_Element_Name('DeviceGray');
|
||||
$smaskStream->dictionary->Type = new Zend_Pdf_Element_Name('XObject');
|
||||
$smaskStream->dictionary->Subtype = new Zend_Pdf_Element_Name('Image');
|
||||
$smaskStream->dictionary->Width = new Zend_Pdf_Element_Numeric($width);
|
||||
$smaskStream->dictionary->Height = new Zend_Pdf_Element_Numeric($height);
|
||||
$smaskStream->dictionary->ColorSpace = new Zend_Pdf_Element_Name('DeviceGray');
|
||||
$smaskStream->dictionary->BitsPerComponent = new Zend_Pdf_Element_Numeric($bits);
|
||||
$imageDictionary->SMask = $smaskStream;
|
||||
|
||||
|
@ -16,18 +16,18 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Tiff.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Tiff.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** 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_Resource_Image */
|
||||
require_once 'Zend/Pdf/Resource/Image.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/**
|
||||
* TIFF image
|
||||
*
|
||||
|
@ -16,14 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: ImageFactory.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: ImageFactory.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf */
|
||||
require_once 'Zend/Pdf.php';
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Pdf_ImageFactory
|
||||
*
|
||||
@ -38,6 +34,7 @@ class Zend_Pdf_Resource_ImageFactory
|
||||
{
|
||||
public static function factory($filename) {
|
||||
if(!is_file($filename)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot create image resource. File not found.");
|
||||
}
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
@ -49,9 +46,11 @@ class Zend_Pdf_Resource_ImageFactory
|
||||
case 'tif':
|
||||
//Fall through to next case;
|
||||
case 'tiff':
|
||||
require_once 'Zend/Pdf/Resource/Image/Tiff.php';
|
||||
return new Zend_Pdf_Resource_Image_Tiff($filename);
|
||||
break;
|
||||
case 'png':
|
||||
require_once 'Zend/Pdf/Resource/Image/Png.php';
|
||||
return new Zend_Pdf_Resource_Image_Png($filename);
|
||||
break;
|
||||
case 'jpg':
|
||||
@ -59,9 +58,11 @@ class Zend_Pdf_Resource_ImageFactory
|
||||
case 'jpe':
|
||||
//Fall through to next case;
|
||||
case 'jpeg':
|
||||
require_once 'Zend/Pdf/Resource/Image/Jpeg.php';
|
||||
return new Zend_Pdf_Resource_Image_Jpeg($filename);
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Cannot create image resource. File extension not known or unsupported type.");
|
||||
break;
|
||||
}
|
||||
|
@ -16,54 +16,22 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: StringParser.php 17532 2009-08-10 19:04:14Z alexander $
|
||||
* @version $Id: StringParser.php 18985 2009-11-14 18:51:34Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_Element_Array */
|
||||
/** Internally used classes */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
|
||||
/** Zend_Pdf_Element_String_Binary */
|
||||
require_once 'Zend/Pdf/Element/String/Binary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Boolean */
|
||||
require_once 'Zend/Pdf/Element/Boolean.php';
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
|
||||
/** Zend_Pdf_Element_Name */
|
||||
require_once 'Zend/Pdf/Element/Name.php';
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference */
|
||||
require_once 'Zend/Pdf/Element/Reference.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object_Stream */
|
||||
require_once 'Zend/Pdf/Element/Object/Stream.php';
|
||||
|
||||
/** Zend_Pdf_Element_String */
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
/** Zend_Pdf_Element_Null */
|
||||
require_once 'Zend/Pdf/Element/Null.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Context */
|
||||
require_once 'Zend/Pdf/Element/Reference/Context.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Table */
|
||||
require_once 'Zend/Pdf/Element/Reference/Table.php';
|
||||
|
||||
/** Zend_Pdf_ElementFactory_Interface */
|
||||
require_once 'Zend/Pdf/ElementFactory/Interface.php';
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
require_once 'Zend/Pdf/Element/Object/Stream.php';
|
||||
require_once 'Zend/Pdf/Element/Reference.php';
|
||||
require_once 'Zend/Pdf/Element/String.php';
|
||||
|
||||
|
||||
/**
|
||||
@ -178,15 +146,33 @@ class Zend_Pdf_StringParser
|
||||
*/
|
||||
public function skipWhiteSpace($skipComment = true)
|
||||
{
|
||||
while ($this->offset < strlen($this->data)) {
|
||||
if (self::isWhiteSpace( ord($this->data[$this->offset]) )) {
|
||||
$this->offset++;
|
||||
} else if (ord($this->data[$this->offset]) == 0x25 && $skipComment) { // '%'
|
||||
$this->skipComment();
|
||||
} else {
|
||||
return;
|
||||
if ($skipComment) {
|
||||
while (true) {
|
||||
$this->offset += strspn($this->data, "\x00\t\n\f\r ", $this->offset);
|
||||
|
||||
if ($this->offset < strlen($this->data) && $this->data[$this->offset] == '%') {
|
||||
// Skip comment
|
||||
$this->offset += strcspn($this->data, "\r\n", $this->offset);
|
||||
} else {
|
||||
// Non white space character not equal to '%' is found
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->offset += strspn($this->data, "\x00\t\n\f\r ", $this->offset);
|
||||
}
|
||||
|
||||
// /** Original (non-optimized) implementation. */
|
||||
//
|
||||
// while ($this->offset < strlen($this->data)) {
|
||||
// if (strpos("\x00\t\n\f\r ", $this->data[$this->offset]) !== false) {
|
||||
// $this->offset++;
|
||||
// } else if (ord($this->data[$this->offset]) == 0x25 && $skipComment) { // '%'
|
||||
// $this->skipComment();
|
||||
// } else {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -247,13 +233,8 @@ class Zend_Pdf_StringParser
|
||||
while (true) {
|
||||
$this->offset += strspn($this->data, "\x00\t\n\f\r ", $this->offset);
|
||||
|
||||
if ($this->data[$this->offset] == '%') {
|
||||
preg_match('/[\r\n]/', $this->data, $matches, PREG_OFFSET_CAPTURE, $this->offset);
|
||||
if (count($matches) > 0) {
|
||||
$this->offset += strlen($matches[0][0]) + $matches[0][1];
|
||||
} else {
|
||||
$this->offset = strlen($this->data);
|
||||
}
|
||||
if ($this->offset < strlen($this->data) && $this->data[$this->offset] == '%') {
|
||||
$this->offset += strcspn($this->data, "\r\n", $this->offset);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -263,25 +244,27 @@ class Zend_Pdf_StringParser
|
||||
return '';
|
||||
}
|
||||
|
||||
$start = $this->offset;
|
||||
if ( /* self::isDelimiter( ord($this->data[$start]) ) */
|
||||
strpos('()<>[]{}/%', $this->data[$this->offset]) !== false ) {
|
||||
|
||||
if (self::isDelimiter( ord($this->data[$start]) )) {
|
||||
if ($this->data[$start] == '<' && $this->offset + 1 < strlen($this->data) && $this->data[$start+1] == '<') {
|
||||
$this->offset += 2;
|
||||
return '<<';
|
||||
} else if ($this->data[$start] == '>' && $this->offset + 1 < strlen($this->data) && $this->data[$start+1] == '>') {
|
||||
$this->offset += 2;
|
||||
return '>>';
|
||||
} else {
|
||||
$this->offset++;
|
||||
return $this->data[$start];
|
||||
switch (substr($this->data, $this->offset, 2)) {
|
||||
case '<<':
|
||||
$this->offset += 2;
|
||||
return '<<';
|
||||
break;
|
||||
|
||||
case '>>':
|
||||
$this->offset += 2;
|
||||
return '>>';
|
||||
break;
|
||||
|
||||
default:
|
||||
return $this->data[$this->offset++];
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
while ( ($this->offset < strlen($this->data)) &&
|
||||
(!self::isDelimiter( ord($this->data[$this->offset]) )) &&
|
||||
(!self::isWhiteSpace( ord($this->data[$this->offset]) )) ) {
|
||||
$this->offset++;
|
||||
}
|
||||
$start = $this->offset;
|
||||
$this->offset += strcspn($this->data, "()<>[]{}/%\x00\t\n\f\r ", $this->offset);
|
||||
|
||||
return substr($this->data, $start, $this->offset - $start);
|
||||
}
|
||||
@ -314,7 +297,7 @@ class Zend_Pdf_StringParser
|
||||
|
||||
case '/':
|
||||
return ($this->_elements[] = new Zend_Pdf_Element_Name(
|
||||
Zend_Pdf_Element_Name::unescape( $this->readLexeme() )
|
||||
Zend_Pdf_Element_Name::unescape( $this->readLexeme() )
|
||||
));
|
||||
|
||||
case '[':
|
||||
@ -334,6 +317,7 @@ class Zend_Pdf_StringParser
|
||||
case '{':
|
||||
// fall through to next case
|
||||
case '}':
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X.',
|
||||
$this->offset));
|
||||
|
||||
@ -368,32 +352,38 @@ class Zend_Pdf_StringParser
|
||||
$start = $this->offset;
|
||||
$openedBrackets = 1;
|
||||
|
||||
$this->offset += strcspn($this->data, '()\\', $this->offset);
|
||||
|
||||
while ($this->offset < strlen($this->data)) {
|
||||
switch (ord( $this->data[$this->offset] )) {
|
||||
case 0x28: // '(' - opened bracket in the string, needs balanced pair.
|
||||
$this->offset++;
|
||||
$openedBrackets++;
|
||||
break;
|
||||
|
||||
case 0x29: // ')' - pair to the opened bracket
|
||||
$this->offset++;
|
||||
$openedBrackets--;
|
||||
break;
|
||||
|
||||
case 0x5C: // '\\' - escape sequence, skip next char from a check
|
||||
$this->offset++;
|
||||
$this->offset += 2;
|
||||
}
|
||||
|
||||
$this->offset++;
|
||||
if ($openedBrackets == 0) {
|
||||
break; // end of string
|
||||
}
|
||||
|
||||
$this->offset += strcspn($this->data, '()\\', $this->offset);
|
||||
}
|
||||
if ($openedBrackets != 0) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while string reading. Offset - 0x%X. \')\' expected.', $start));
|
||||
}
|
||||
|
||||
return new Zend_Pdf_Element_String(Zend_Pdf_Element_String::unescape( substr($this->data,
|
||||
$start,
|
||||
$this->offset - $start - 1) ));
|
||||
$start,
|
||||
$this->offset - $start - 1) ));
|
||||
}
|
||||
|
||||
|
||||
@ -408,21 +398,22 @@ class Zend_Pdf_StringParser
|
||||
{
|
||||
$start = $this->offset;
|
||||
|
||||
while ($this->offset < strlen($this->data)) {
|
||||
if (self::isWhiteSpace( ord($this->data[$this->offset]) ) ||
|
||||
ctype_xdigit( $this->data[$this->offset] ) ) {
|
||||
$this->offset++;
|
||||
} else if ($this->data[$this->offset] == '>') {
|
||||
$this->offset++;
|
||||
return new Zend_Pdf_Element_String_Binary(
|
||||
Zend_Pdf_Element_String_Binary::unescape( substr($this->data,
|
||||
$start,
|
||||
$this->offset - $start - 1) ));
|
||||
} else {
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected character while binary string reading. Offset - 0x%X.', $this->offset));
|
||||
}
|
||||
$this->offset += strspn($this->data, "\x00\t\n\f\r 0123456789abcdefABCDEF", $this->offset);
|
||||
|
||||
if ($this->offset >= strlen($this->data) - 1) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while reading binary string. Offset - 0x%X. \'>\' expected.', $start));
|
||||
}
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while binary string reading. Offset - 0x%X. \'>\' expected.', $start));
|
||||
|
||||
if ($this->data[$this->offset++] != '>') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected character while binary string reading. Offset - 0x%X.', $this->offset));
|
||||
}
|
||||
|
||||
return new Zend_Pdf_Element_String_Binary(
|
||||
Zend_Pdf_Element_String_Binary::unescape( substr($this->data,
|
||||
$start,
|
||||
$this->offset - $start - 1) ));
|
||||
}
|
||||
|
||||
|
||||
@ -445,6 +436,7 @@ class Zend_Pdf_StringParser
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while array reading. Offset - 0x%X. \']\' expected.', $this->offset));
|
||||
}
|
||||
|
||||
@ -468,6 +460,7 @@ class Zend_Pdf_StringParser
|
||||
$value = $this->readElement();
|
||||
|
||||
if (!$name instanceof Zend_Pdf_Element_Name) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Name object expected while dictionary reading. Offset - 0x%X.', $nameStart));
|
||||
}
|
||||
|
||||
@ -477,6 +470,7 @@ class Zend_Pdf_StringParser
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Unexpected end of file while dictionary reading. Offset - 0x%X. \'>>\' expected.', $this->offset));
|
||||
}
|
||||
|
||||
@ -557,16 +551,19 @@ class Zend_Pdf_StringParser
|
||||
|
||||
$objNum = $this->readLexeme();
|
||||
if (!ctype_digit($objNum)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Object number expected.', $this->offset - strlen($objNum)));
|
||||
}
|
||||
|
||||
$genNum = $this->readLexeme();
|
||||
if (!ctype_digit($genNum)) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Object generation number expected.', $this->offset - strlen($genNum)));
|
||||
}
|
||||
|
||||
$objKeyword = $this->readLexeme();
|
||||
if ($objKeyword != 'obj') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'obj\' keyword expected.', $this->offset - strlen($objKeyword)));
|
||||
}
|
||||
|
||||
@ -595,10 +592,12 @@ class Zend_Pdf_StringParser
|
||||
* It's a stream object
|
||||
*/
|
||||
if ($nextLexeme != 'stream') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endobj\' or \'stream\' keywords expected.', $this->offset - strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
if (!$objValue instanceof Zend_Pdf_Element_Dictionary) {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. Stream extent must be preceded by stream dictionary.', $this->offset - strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
@ -617,6 +616,7 @@ class Zend_Pdf_StringParser
|
||||
} else if ($this->data[$this->offset] == "\n" ) {
|
||||
$this->offset++;
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'stream\' must be followed by either cr-lf sequence or lf character only.', $this->offset - strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
@ -626,11 +626,13 @@ class Zend_Pdf_StringParser
|
||||
|
||||
$nextLexeme = $this->readLexeme();
|
||||
if ($nextLexeme != 'endstream') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endstream\' keyword expected.', $this->offset - strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
$nextLexeme = $this->readLexeme();
|
||||
if ($nextLexeme != 'endobj') {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception(sprintf('PDF file syntax error. Offset - 0x%X. \'endobj\' keyword expected.', $this->offset - strlen($nextLexeme)));
|
||||
}
|
||||
|
||||
|
@ -16,24 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Style.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Style.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Color */
|
||||
require_once 'Zend/Pdf/Color.php';
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_Numeric */
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
|
||||
/** Zend_Pdf_Element_Array */
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
|
||||
/** Zend_Pdf_Resource_Font */
|
||||
require_once 'Zend/Pdf/Resource/Font.php';
|
||||
|
||||
|
||||
/**
|
||||
* Style object.
|
||||
* Style object doesn't directly correspond to any PDF file object.
|
||||
@ -148,6 +134,7 @@ class Zend_Pdf_Style
|
||||
*/
|
||||
public function setLineWidth($width)
|
||||
{
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
$this->_lineWidth = new Zend_Pdf_Element_Numeric($width);
|
||||
}
|
||||
|
||||
@ -160,11 +147,13 @@ class Zend_Pdf_Style
|
||||
*/
|
||||
public function setLineDashingPattern($pattern, $phase = 0)
|
||||
{
|
||||
require_once 'Zend/Pdf/Page.php';
|
||||
if ($pattern === Zend_Pdf_Page::LINE_DASHING_SOLID) {
|
||||
$pattern = array();
|
||||
$phase = 0;
|
||||
}
|
||||
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
$this->_lineDashingPattern = $pattern;
|
||||
$this->_lineDashingPhase = new Zend_Pdf_Element_Numeric($phase);
|
||||
}
|
||||
@ -286,8 +275,10 @@ class Zend_Pdf_Style
|
||||
}
|
||||
|
||||
if ($this->_lineDashingPattern !== null) {
|
||||
require_once 'Zend/Pdf/Element/Array.php';
|
||||
$dashPattern = new Zend_Pdf_Element_Array();
|
||||
|
||||
require_once 'Zend/Pdf/Element/Numeric.php';
|
||||
foreach ($this->_lineDashingPattern as $dashItem) {
|
||||
$dashElement = new Zend_Pdf_Element_Numeric($dashItem);
|
||||
$dashPattern->items[] = $dashElement;
|
||||
|
@ -20,9 +20,6 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_ElementFactory */
|
||||
require_once 'Zend/Pdf/ElementFactory.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF target (action or destination)
|
||||
@ -42,9 +39,11 @@ abstract class Zend_Pdf_Target
|
||||
* @throws Zend_Pdf_Exception
|
||||
*/
|
||||
public static function load(Zend_Pdf_Element $resource) {
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
if ($resource->getType() == Zend_Pdf_Element::TYPE_DICTIONARY) {
|
||||
if (($resource->Type === null || $resource->Type->value =='Action') && $resource->S !== null) {
|
||||
// It's a well-formed action, load it
|
||||
require_once 'Zend/Pdf/Action.php';
|
||||
return Zend_Pdf_Action::load($resource);
|
||||
} else if ($resource->D !== null) {
|
||||
// It's a destination
|
||||
@ -56,9 +55,10 @@ abstract class Zend_Pdf_Target
|
||||
}
|
||||
|
||||
if ($resource->getType() == Zend_Pdf_Element::TYPE_ARRAY ||
|
||||
$resource->getType() == Zend_Pdf_Element::TYPE_NAME ||
|
||||
$resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
|
||||
$resource->getType() == Zend_Pdf_Element::TYPE_NAME ||
|
||||
$resource->getType() == Zend_Pdf_Element::TYPE_STRING) {
|
||||
// Resource is an array, just treat it as an explicit destination array
|
||||
require_once 'Zend/Pdf/Destination.php';
|
||||
return Zend_Pdf_Destination::load($resource);
|
||||
} else {
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
|
@ -16,14 +16,10 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Trailer.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Trailer.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Element_Dictionary */
|
||||
require_once 'Zend/Pdf/Element/Dictionary.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file trailer
|
||||
*
|
||||
@ -52,6 +48,7 @@ abstract class Zend_Pdf_Trailer
|
||||
{
|
||||
if ( !in_array($key, self::$_allowedKeys) ) {
|
||||
/** @todo Make warning (log entry) instead of an exception */
|
||||
require_once 'Zend/Pdf/Exception.php';
|
||||
throw new Zend_Pdf_Exception("Unknown trailer dictionary key: '$key'.");
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Generator.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Generator.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Trailer */
|
||||
require_once 'Zend/Pdf/Trailer.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file trailer generator (used for just created PDF)
|
||||
*
|
||||
@ -50,6 +49,7 @@ class Zend_Pdf_Trailer_Generator extends Zend_Pdf_Trailer
|
||||
*/
|
||||
public function getPDFLength()
|
||||
{
|
||||
require_once 'Zend/Pdf.php';
|
||||
return strlen(Zend_Pdf::PDF_HEADER);
|
||||
}
|
||||
|
||||
@ -60,6 +60,7 @@ class Zend_Pdf_Trailer_Generator extends Zend_Pdf_Trailer
|
||||
*/
|
||||
public function getPDFString()
|
||||
{
|
||||
require_once 'Zend/Pdf.php';
|
||||
return Zend_Pdf::PDF_HEADER;
|
||||
}
|
||||
|
||||
|
@ -16,17 +16,13 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Keeper.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: Keeper.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/** Zend_Pdf_Trailer */
|
||||
require_once 'Zend/Pdf/Trailer.php';
|
||||
|
||||
/** Zend_Pdf_Element_Reference_Context */
|
||||
require_once 'Zend/Pdf/Element/Reference/Context.php';
|
||||
|
||||
|
||||
/**
|
||||
* PDF file trailer.
|
||||
* Stores and provides access to the trailer parced from a PDF file
|
||||
@ -61,7 +57,7 @@ class Zend_Pdf_Trailer_Keeper extends Zend_Pdf_Trailer
|
||||
*/
|
||||
public function __construct(Zend_Pdf_Element_Dictionary $dict,
|
||||
Zend_Pdf_Element_Reference_Context $context,
|
||||
$prev = null)
|
||||
Zend_Pdf_Trailer $prev = null)
|
||||
{
|
||||
parent::__construct($dict);
|
||||
|
||||
|
@ -16,18 +16,9 @@
|
||||
* @package Zend_Pdf
|
||||
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: UpdateInfoContainer.php 16541 2009-07-07 06:59:03Z bkarwin $
|
||||
* @version $Id: UpdateInfoContainer.php 18993 2009-11-15 17:09:16Z alexander $
|
||||
*/
|
||||
|
||||
/** Zend_Pdf_Element */
|
||||
require_once 'Zend/Pdf/Element.php';
|
||||
|
||||
/** Zend_Pdf_Element_Object */
|
||||
require_once 'Zend/Pdf/Element/Object.php';
|
||||
|
||||
/** Zend_Memory */
|
||||
require_once 'Zend/Memory.php';
|
||||
|
||||
|
||||
/**
|
||||
* Container which collects updated object info.
|
||||
@ -80,6 +71,7 @@ class Zend_Pdf_UpdateInfoContainer
|
||||
|
||||
if ($dump !== null) {
|
||||
if (strlen($dump) > 1024) {
|
||||
require_once 'Zend/Pdf.php';
|
||||
$this->_dump = Zend_Pdf::getMemoryManager()->create($dump);
|
||||
} else {
|
||||
$this->_dump = $dump;
|
||||
|
Reference in New Issue
Block a user