Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def save(self, file):
#avoid crashes if they wrote nothing in the page
if self.data == None:
self.data = TestStream
if self.compression == 1:
comp = zlib.compress(self.data) #this bit is very fast...
base85 = pdfutils._AsciiBase85Encode(comp) #...sadly this isn't
data_to_write = pdfutils._wrap(base85)
else:
data_to_write = self.data
# the PDF length key should contain the length including
# any extra LF pairs added by Print on DOS.
#lines = len(string.split(self.data,'\n'))
#length = len(self.data) + lines # one extra LF each
length = len(data_to_write) + len(LINEEND) #AR 19980202
if self.fontType == None:
fontStreamEntry = ""
else:
fontStreamEntry = "/Subtype %s" % (self.fontType)
if self.compression:
file.write(('<< %s /Length %d /Filter [/ASCII85Decode /FlateDecode] >>' % (fontStreamEntry, length) + LINEEND).encode('utf-8'))
else:
def save(self, file):
#avoid crashes if they wrote nothing in the page
if self.data == None:
self.data = TestStream
if self.compression == 1:
comp = zlib.compress(self.data) #this bit is very fast...
base85 = pdfutils._AsciiBase85Encode(comp) #...sadly this isn't
wrapped = pdfutils._wrap(base85)
data_to_write = wrapped
else:
data_to_write = self.data
# the PDF length key should contain the length including
# any extra LF pairs added by Print on DOS.
#lines = len(string.split(self.data,'\n'))
#length = len(self.data) + lines # one extra LF each
length = len(data_to_write) + len(LINEEND) #AR 19980202
if self.fontType == None:
fontStreamEntry = ""
else:
fontStreamEntry = "/Subtype %s" % (self.fontType)
if self.compression:
def save(self, file):
#avoid crashes if they wrote nothing in the page
if self.data == None:
self.data = TestStream
if self.compression == 1:
comp = zlib.compress(self.data) #this bit is very fast...
base85 = pdfutils._AsciiBase85Encode(comp) #...sadly this isn't
data_to_write = pdfutils._wrap(base85)
else:
data_to_write = self.data
# the PDF length key should contain the length including
# any extra LF pairs added by Print on DOS.
#lines = len(string.split(self.data,'\n'))
#length = len(self.data) + lines # one extra LF each
length = len(data_to_write) + len(LINEEND) #AR 19980202
if self.fontType == None:
fontStreamEntry = ""
else:
fontStreamEntry = "/Subtype %s" % (self.fontType)
if self.compression:
file.write(('<< %s /Length %d /Filter [/ASCII85Decode /FlateDecode] >>' % (fontStreamEntry, length) + LINEEND).encode('utf-8'))
def save(self, file):
#avoid crashes if they wrote nothing in the page
if self.data == None:
self.data = TestStream
if self.compression == 1:
comp = zlib.compress(self.data) #this bit is very fast...
base85 = pdfutils._AsciiBase85Encode(comp) #...sadly this isn't
wrapped = pdfutils._wrap(base85)
data_to_write = wrapped
else:
data_to_write = self.data
# the PDF length key should contain the length including
# any extra LF pairs added by Print on DOS.
#lines = len(string.split(self.data,'\n'))
#length = len(self.data) + lines # one extra LF each
length = len(data_to_write) + len(LINEEND) #AR 19980202
if self.fontType == None:
fontStreamEntry = ""
else:
fontStreamEntry = "/Subtype %s" % (self.fontType)
if self.compression:
file.write('<< %s /Length %d /Filter [/ASCII85Decode /FlateDecode] >>' % (fontStreamEntry, length) + LINEEND)