(self, data, filename)
provide either data or filename
provide either data or filename
provide either data or filename
def __init__(self, data, filename):
        """ provide either data or filename"""
        if data is not None:
            f = tempfile.NamedTemporaryFile(delete=False, suffix='.pdf')
            f.close()
            with open(f.name, 'w') as fpdf:
                fpdf.write(data)
            self.fname = f.name
            self.createfile = True
        else:
            self.fname = filename
            self.createfile = False
        assert self.fname is not None
        self.convert()
def __init__ ( self , data , filename ) : if data is not None : f = tempfile . NamedTemporaryFile ( delete = False , suffix = '.pdf' ) f . close ( ) with open ( f . name , 'w' ) as fpdf : fpdf . write ( data ) self . fname = f . name self . createfile = True else : self . fname = filename self . createfile = False assert self . fname is not None self . convert ( )