Guest User

feliam

a guest
Feb 11th, 2010
277
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def _zipEmbeddeFile(doc, f,minimal=False):
  2.     fileStr = file(f).read()
  3.     embedded = PDFStream(fileStr)
  4.     if not minimal:
  5.         embedded.add('Type', PDFName('EmbeddedFile'))
  6.         embedded.add('Params',PDFDict({'Size': PDFNum(len(fileStr)),
  7.                                  'CheckSum': PDFOctalString(md5.new(fileStr).digest())}) )
  8.         embedded.add('DL', ' %d '%len(fileStr))
  9.     embedded.appendFilter(FlateDecode())
  10.     doc.add(embedded)
  11.  
  12.     #embedded list
  13.     embeddedlst = PDFDict()
  14.     embeddedlst.add('F',PDFRef(embedded))
  15.  
  16.     #fileSpec
  17.     filespec = PDFDict()
  18.     filespec.add('Type',PDFName('Filespec'))
  19.     filespec.add('F',PDFString(f))
  20.     filespec.add('EF', embeddedlst)
  21.     doc.add(filespec)
  22.     return filespec
  23.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×