Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(33)  |  Call(24)  |  Derive(0)  |  Import(9)
Encode the given stream

@param stream: Stream to be decoded (string)
@param filter: Filter to apply to decode the stream
@param parameters: List of PDFObjects containing the parameters for the filter
@return: A tuple (status,statusContent), where statusContent is the encoded stream in case status = 0 or an error in case status = -1

        def encodeStream(stream, filter, parameters = {}):
	'''
		Encode the given stream
		
		@param stream: Stream to be decoded (string)
		@param filter: Filter to apply to decode the stream
		@param parameters: List of PDFObjects containing the parameters for the filter
		@return: A tuple (status,statusContent), where statusContent is the encoded stream in case status = 0 or an error in case status = -1
	'''
	if filter == '/ASCIIHexDecode':
		ret = asciiHexEncode(stream)
	elif filter == '/ASCII85Decode':
		ret = ascii85Encode(stream)
	elif filter == '/LZWDecode':
		ret = lzwEncode(stream, parameters)
	elif filter == '/FlateDecode':
		ret = flateEncode(stream, parameters)
	elif filter == '/RunLengthDecode':
		ret = runLengthEncode(stream)
	elif filter == '/CCITTFaxDecode':
		ret = ccittFaxEncode(stream, parameters)
	elif filter == '/JBIG2Decode':
		ret = jbig2Encode(stream, parameters)
	elif filter == '/DCTDecode':
		ret = dctEncode(stream, parameters)
	elif filter == '/JPXDecode':
		ret = jpxEncode(stream)
	elif filter == '/Crypt':
		ret = crypt(stream, parameters)
	return ret
        


src/t/h/thug-HEAD/src/peepdf/PDFCore.py   thug(Download)
from PDFCrypto import *
from JSAnalysis import *
from PDFFilters import decodeStream,encodeStream
 
MAL_ALL = 1
            if filterType == 'name':
                if self.filterParams == None:
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams)
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                        self.rawStream = ret[1]
                elif filterParamsType == 'dictionary':
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams.getElements())
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                    if filter.getType() == 'name':
                        if self.filterParams == None:
                            ret = encodeStream(self.rawStream, filter.getValue(), self.filterParams)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]
                                paramsDict = {}
 
                            ret = encodeStream(self.rawStream, filter.getValue(), paramsDict)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]

src/c/l/classyPDF-HEAD/peepdf_classy/PDFCore.py   classyPDF(Download)
from PDFCrypto import *
from JSAnalysis import *
from PDFFilters import decodeStream,encodeStream
 
MAL_ALL = 1
            if filterType == 'name':
                if self.filterParams == None:
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams)
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                        self.rawStream = ret[1]
                elif filterParamsType == 'dictionary':
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams.getElements())
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                    if filter.getType() == 'name':
                        if self.filterParams == None:
                            ret = encodeStream(self.rawStream, filter.getValue(), self.filterParams)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]
                                    continue
                                return (-1,'Bad /FilterParms element in PDFArray')
                            ret = encodeStream(self.rawStream, filter.getValue(), params.getElements())
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]

src/c/l/classyPDF-HEAD/peepdf_classy/bsdPDFCore.py   classyPDF(Download)
from PDFCrypto import *
from JSAnalysis import *
from PDFFilters import decodeStream,encodeStream
 
MAL_ALL = 1
            if filterType == 'name':
                if self.filterParams == None:
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams)
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                        self.rawStream = ret[1]
                elif filterParamsType == 'dictionary':
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams.getElements())
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                    if filter.getType() == 'name':
                        if self.filterParams == None:
                            ret = encodeStream(self.rawStream, filter.getValue(), self.filterParams)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]
                                    continue
                                return (-1,'Bad /FilterParms element in PDFArray')
                            ret = encodeStream(self.rawStream, filter.getValue(), params.getElements())
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]

src/p/d/pdfxray_public-HEAD/apps/peep/PDFCore.py   pdfxray_public(Download)
from PDFCrypto import *
from JSAnalysis import *
from PDFFilters import decodeStream,encodeStream
 
MAL_ALL = 1
            if filterType == 'name':
                if self.filterParams == None:
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams)
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                        self.rawStream = ret[1]
                elif filterParamsType == 'dictionary':
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams.getElements())
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                    if filter.getType() == 'name':
                        if self.filterParams == None:
                            ret = encodeStream(self.rawStream, filter.getValue(), self.filterParams)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]
                                    continue
                                return (-1,'Bad /FilterParms element in PDFArray')
                            ret = encodeStream(self.rawStream, filter.getValue(), params.getElements())
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]

src/p/d/pdfxray_lite-HEAD/lib/PDFCore.py   pdfxray_lite(Download)
from PDFCrypto import *
from JSAnalysis import *
from PDFFilters import decodeStream,encodeStream
 
MAL_ALL = 1
            if filterType == 'name':
                if self.filterParams == None:
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams)
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                        self.rawStream = ret[1]
                elif filterParamsType == 'dictionary':
                    ret = encodeStream(self.decodedStream, self.filter.getValue(), self.filterParams.getElements())
                    if ret[0] == -1:
                        errorMessage = 'Encoding error: '+ret[1]
                    if filter.getType() == 'name':
                        if self.filterParams == None:
                            ret = encodeStream(self.rawStream, filter.getValue(), self.filterParams)
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]
                                    continue
                                return (-1,'Bad /FilterParms element in PDFArray')
                            ret = encodeStream(self.rawStream, filter.getValue(), params.getElements())
                            if ret[0] == -1:
                                errorMessage = 'Encoding error: '+ret[1]

src/t/h/thug-HEAD/src/peepdf/PDFConsole.py   thug(Download)
from PDFCore import *
from base64 import b64encode,b64decode
from PDFFilters import decodeStream,encodeStream
from jjdecode import JJDecoder
 
                encodedContent = b64encode(encodedContent)
            else:
                ret = encodeStream(encodedContent, realFilter)
                if ret[0] == -1:
                    message = '*** Error: '+ret[1]+'!!'

src/c/l/classyPDF-HEAD/peepdf_classy/PDFConsole.py   classyPDF(Download)
from PDFCore import *
from base64 import b64encode,b64decode
from PDFFilters import decodeStream,encodeStream
try:
    from colorama import init, Fore, Back, Style
                encodedContent = b64encode(encodedContent)
            else:
                ret = encodeStream(encodedContent, realFilter)
                if ret[0] == -1:
                    message = '*** Error: '+ret[1]+'!!'

src/p/d/pdfxray_public-HEAD/apps/peep/PDFConsole.py   pdfxray_public(Download)
from PDFCore import *
from base64 import b64encode,b64decode
from PDFFilters import decodeStream,encodeStream
try:
    from spidermonkey import Runtime
                encodedContent = b64encode(encodedContent)
            else:
                ret = encodeStream(encodedContent, realFilter)
                if ret[0] == -1:
                    message = '*** Error: '+ret[1]+'!!'

src/p/d/pdfxray_lite-HEAD/lib/PDFConsole.py   pdfxray_lite(Download)
from PDFCore import *
from base64 import b64encode,b64decode
from PDFFilters import decodeStream,encodeStream
try:
    from spidermonkey import Runtime
                encodedContent = b64encode(encodedContent)
            else:
                ret = encodeStream(encodedContent, realFilter)
                if ret[0] == -1:
                    message = '*** Error: '+ret[1]+'!!'