Пример #1
0
    def makeStream(self, width, height, stream, **D):
        D['Matrix'] = PDFArray([1.0, 0.0, 0.0, 1.0, 0.0, 0.0])
        D['BBox'] = PDFArray([0, 0, width, height])
        D['Subtype'] = PDFName('Form')
        D['Type'] = PDFName('XObject')
        D['FormType'] = 1

        s = PDFStream(
            PDFDictionary(D),
            stream,
            filters=[PDFStreamFilterZCompress()]
            if self.canv._doc.compression else None,
        )
        #compute a lookup string
        s._af_refstr = stream + '\n'.join(
            ('%s=%r' % (k, _pdfObjToStr(v)) for k, v in sorted(D.items())))
        return s
Пример #2
0
    def makeStream(self,
                width,
                height,
                stream,
                **D
                ):
        D['Matrix'] = PDFArray([1.0,0.0,0.0,1.0,0.0,0.0])
        D['BBox'] = PDFArray([0,0,width,height])
        D['Subtype'] = PDFName('Form')
        D['Type'] = PDFName('XObject')
        D['FormType'] = 1

        s = PDFStream(
                PDFDictionary(D),
                stream,
                filters = [PDFStreamFilterZCompress()] if self.canv._doc.compression else None,
                )
        #compute a lookup string
        s._af_refstr = stream+'\n'.join(('%s=%r' % (k,_pdfObjToStr(v)) for k,v in sorted(D.items())))
        return s
Пример #3
0
 def save(self):
     data = PDFStream(dictionary=PDFDictionary({
         'Type': PDFName('Data'),
         'Subtype': PDFName('XML')
     }),
                      content=self.xml,
                      filters=None)
     self._doc.Reference(data)
     if 'Data' not in self._doc.Catalog.__NoDefault__:
         self._doc.Catalog.__NoDefault__.append('Data')
     self._doc.Catalog.__setattr__('Data', data)
     Canvas.save(self)
Пример #4
0
def ButtonStream(content):
    dict = buttonStreamDictionary()
    result = PDFStream(dict, content)
    result.filters = []
    return result
Пример #5
0
def ButtonStream(content, width=16.7704, height=14.907):
    result = PDFStream(buttonStreamDictionary(width=width, height=height),
                       content)
    result.filters = []
    return result
def ButtonStream(content):
    dict = buttonStreamDictionary()
    result = PDFStream(dict, content)
    result.filters = []
    return result
Пример #7
0
def ButtonStream(content, width=16.7704, height=14.907):
    result = PDFStream(buttonStreamDictionary(width=width, height=height), content)
    result.filters = []
    return result