7
* This source file is subject to the new BSD license that is bundled
8
* with this package in the file LICENSE.txt.
9
* It is also available through the world-wide-web at this URL:
10
* http://framework.zend.com/license/new-bsd
11
* If you did not receive a copy of the license and are unable to
12
* obtain it through the world-wide-web, please send an email
13
* to license@zend.com so we can send you a copy immediately.
16
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
17
* @license http://framework.zend.com/license/new-bsd New BSD License
21
/** Zend_Pdf_Filter_Compression */
22
require_once 'Zend/Pdf/Filter/Compression.php';
29
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
30
* @license http://framework.zend.com/license/new-bsd New BSD License
32
class Zend_Pdf_Filter_Compression_Flate extends Zend_Pdf_Filter_Compression
38
* @param array $params
40
* @throws Zend_Pdf_Exception
42
public static function encode($data, $params = null)
44
if ($params != null) {
45
$data = self::_applyEncodeParams($data, $params);
48
if (extension_loaded('zlib')) {
49
$trackErrors = ini_get( "track_errors");
50
ini_set('track_errors', '1');
52
if (($output = @gzcompress($data)) === false) {
53
ini_set('track_errors', $trackErrors);
54
throw new Zend_Pdf_Exception($php_errormsg);
57
ini_set('track_errors', $trackErrors);
59
throw new Zend_Pdf_Exception('Not implemented yet. You have to use zlib extension.');
69
* @param array $params
71
* @throws Zend_Pdf_Exception
73
public static function decode($data, $params = null)
77
if (extension_loaded('zlib')) {
78
$trackErrors = ini_get( "track_errors");
79
ini_set('track_errors', '1');
81
if (($output = @gzuncompress($data)) === false) {
82
ini_set('track_errors', $trackErrors);
83
throw new Zend_Pdf_Exception($php_errormsg);
86
ini_set('track_errors', $trackErrors);
88
throw new Zend_Pdf_Exception('Not implemented yet');
91
if ($params !== null) {
92
return self::_applyDecodeParams($output, $params);