public function testStringNotDivisibleBy4Decode() { $encodedContents = "9Q+r_D'3P3F*2=BA8c:&EZfF;F<G\"/ATTIG@rH7+ARfgn" . "FEMUH@rc\"!+CT+uF=m~>"; $decodedContents = Zend_Pdf_Filter_Ascii85::decode($encodedContents); $testString = 'Lorem ipsum dolor sit amet, consectetur cras amet.'; $this->assertEquals($decodedContents, $testString); }
/** * Decode stream * * @throws Zend_Pdf_Exception */ private function _decodeStream() { if ($this->_initialDictionaryData === null) { $this->_initialDictionaryData = $this->_extractDictionaryData(); } /** * All applied stream filters must be processed to decode stream. * If we don't recognize any of applied filetrs an exception should be thrown here */ if (isset($this->_initialDictionaryData['F'])) { /** @todo Check, how external files can be processed. */ require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('External filters are not supported now.'); } foreach ($this->_initialDictionaryData['Filter'] as $id => $filterName) { $valueRef =& $this->_value->value->getRef(); $this->_value->value->touch(); switch ($filterName) { case 'ASCIIHexDecode': require_once 'Zend/Pdf/Filter/AsciiHex.php'; $valueRef = Zend_Pdf_Filter_AsciiHex::decode($valueRef); break; case 'ASCII85Decode': require_once 'Zend/Pdf/Filter/Ascii85.php'; $valueRef = Zend_Pdf_Filter_Ascii85::decode($valueRef); break; case 'FlateDecode': require_once 'Zend/Pdf/Filter/Compression/Flate.php'; $valueRef = Zend_Pdf_Filter_Compression_Flate::decode($valueRef, $this->_initialDictionaryData['DecodeParms'][$id]); break; case 'LZWDecode': require_once 'Zend/Pdf/Filter/Compression/Lzw.php'; $valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef, $this->_initialDictionaryData['DecodeParms'][$id]); break; case 'RunLengthDecode': require_once 'Zend/Pdf/Filter/RunLength.php'; $valueRef = Zend_Pdf_Filter_RunLength::decode($valueRef); break; default: require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.'); } } $this->_streamDecoded = true; }
/** * Decode stream * * @throws Zend_Pdf_Exception */ private function _decodeStream() { if ($this->_originalDictionary === null) { $this->_storeOriginalDictionary(); } /** * All applied stream filters must be processed to decode stream. * If we don't recognize any of applied filetrs an exception should be thrown here */ if (isset($this->_originalDictionary['F'])) { /** @todo Check, how external files can be processed. */ throw new Zend_Pdf_Exception('External filters are not supported now.'); } foreach ($this->_originalDictionary['Filter'] as $id => $filterName) { $valueRef =& $this->_value->value->getRef(); $this->_value->value->touch(); switch ($filterName) { case 'ASCIIHexDecode': $valueRef = Zend_Pdf_Filter_AsciiHex::decode($valueRef); break; case 'ASCII85Decode': $valueRef = Zend_Pdf_Filter_Ascii85::decode($valueRef); break; case 'FlateDecode': $valueRef = Zend_Pdf_Filter_Compression_Flate::decode($valueRef, $this->_originalDictionary['DecodeParms'][$id]); break; case 'LZWDecode': $valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef, $this->_originalDictionary['DecodeParms'][$id]); break; default: throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.'); } } $this->_streamDecoded = true; }
private function _decodeStream() { if ($this->_initialDictionaryData === null) { $this->_initialDictionaryData = $this->_extractDictionaryData(); } if (isset($this->_initialDictionaryData['F'])) { throw new Zend_Pdf_Exception('External filters are not supported now.'); } foreach ($this->_initialDictionaryData['Filter'] as $id => $filterName) { $valueRef =& $this->_value->value->getRef(); $this->_value->value->touch(); switch ($filterName) { case 'ASCIIHexDecode': $valueRef = Zend_Pdf_Filter_AsciiHex::decode($valueRef); break; case 'ASCII85Decode': $valueRef = Zend_Pdf_Filter_Ascii85::decode($valueRef); break; case 'FlateDecode': $valueRef = Zend_Pdf_Filter_Compression_Flate::decode($valueRef, $this->_initialDictionaryData['DecodeParms'][$id]); break; case 'LZWDecode': $valueRef = Zend_Pdf_Filter_Compression_Lzw::decode($valueRef, $this->_initialDictionaryData['DecodeParms'][$id]); break; case 'RunLengthDecode': $valueRef = Zend_Pdf_Filter_RunLength::decode($valueRef); break; default: throw new Zend_Pdf_Exception('Unknown stream filter: \'' . $filterName . '\'.'); } } $this->_streamDecoded = true; }