I have written a few classes that use the fpdf2 library (version 2.5.7). I want to merge two of them to create a pdf with the methods from the two classes.
How can I do that?
Here is a basic example of my tentative:
EDIT
class SWISS_BILL(FPDF) :
def __init__(self, path_image) :
self.interligne = 4
self.path_image = path_image
def pdf_swissbill(self, data) :
self.set_font('Arial', 'B', 16)
self.cell(40, 10, data)
class QR_BILL(FPDF) :
def __init__(self, ref_y_start) :
self.loc_y_ref_bill = ref_y_start
self.interligne_9pt = 9 # in pt
def pdf_qr(self, data) :
self.set_font('Arial', 'B', 16)
self.cell(40, 10, data)
class TOTAL(QR_BILL, SWISS_BILL) :
def __init__(self, path_image, ref_y_start, orientation, unit, format) :
QR_BILL.__init__(ref_y_start)
SWISS_BILL.__init__(path_image)
self.orientation = orientation
self.unit = unit
self.format = format
pdf = TOTAL('path_image', 60, 'P', 'mm', 'A4')
pdf.add_page()
pdf.pdf_qr('bonjour')
pdf.ln(h=60)
pdf.pdf_swissbill('merci')
pdf.output('test_merge_two_class2.pdf')
The error :
QR_BILL.__init__(ref_y_start)
TypeError: QR_BILL.__init__() missing 1 required positional argument: 'ref_y_start'