import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -18,10 +18,6 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/** Zend_Pdf_Exception */
require_once 'Zend/Pdf/Exception.php';
/** Zend_Pdf_Page */
require_once 'Zend/Pdf/Page.php';
@ -73,11 +69,9 @@ require_once 'Zend/Pdf/Resource/Image/Tiff.php';
/** Zend_Pdf_Image_Png */
require_once 'Zend/Pdf/Resource/Image/Png.php';
/** Zend_Memory */
require_once 'Zend/Memory.php';
/**
* General entity which describes PDF document.
* It implements document abstraction with a document level operations.
@ -262,6 +256,7 @@ class Zend_Pdf
public function save($filename, $updateOnly = false)
{
if (($file = @fopen($filename, $updateOnly ? 'ab':'wb')) === false ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception( "Can not open '$filename' file for writing." );
}
@ -296,6 +291,10 @@ class Zend_Pdf
if ($source !== null) {
$this->_parser = new Zend_Pdf_Parser($source, $this->_objFactory, $load);
$this->_trailer = $this->_parser->getTrailer();
if ($this->_trailer->Encrypt !== null) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Encrypted document modification is not supported');
}
if ($revision !== null) {
$this->rollback($revision);
} else {
@ -418,6 +417,7 @@ class Zend_Pdf
protected function _loadPages(Zend_Pdf_Element_Reference $pages, $attributes = array())
{
if ($pages->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong argument');
}
@ -601,6 +601,7 @@ class Zend_Pdf
}
$fonts = array();
require_once 'Zend/Pdf/Exception.php';
foreach ($fontResourcesUnique as $resourceReference => $fontDictionary) {
try {
// Try to extract font
@ -627,6 +628,7 @@ class Zend_Pdf
public function extractFont($fontName)
{
$fontResourcesUnique = array();
require_once 'Zend/Pdf/Exception.php';
foreach ($this->pages as $page) {
$pageResources = $page->extractResources();
@ -705,6 +707,7 @@ class Zend_Pdf
break;
default:
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Wrong Trapped document property vale: \'' . $value . '\'. Only true, false and null values are allowed.');
break;
}
@ -726,6 +729,12 @@ class Zend_Pdf
case 'Creator':
// break intentionally omitted
case 'Producer':
if (extension_loaded('mbstring') === true) {
$detected = mb_detect_encoding($value);
if ($detected !== 'ASCII') {
$value = chr(254) . chr(255) . mb_convert_encoding($value, 'UTF-16', $detected);
}
}
$docInfo->$key = new Zend_Pdf_Element_String((string)$value);
break;
@ -889,7 +898,7 @@ class Zend_Pdf
*/
public static function pdfDate($timestamp = null)
{
if (is_null($timestamp)) {
if ($timestamp === null) {
$date = date('\D\:YmdHisO');
} else {
$date = date('\D\:YmdHisO', $timestamp);