You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from fpdf import FPDF
import multiprocessing
from multiprocessing import Pool
class pdf_gen():
def __init__(self):
pdf = self.pdf = FPDF()
pdf.set_auto_page_break(True,0.1)
def get_data_from_mysql(self):
pdf = self.pdf
# connection is established and result is stored in 'res'.
dup = []
dup.insert(0,res)
z = tuple(dup)
return z
def mysql_to_pdf_data(self,*result) :
try :
pdf = self.pdf
# Entered data need to be in pdf
finally:
return pdf
if __name__ == "__main__" :
class_pdf_object = pdf_gen()
pdf_object = FPDF()
recover_data = class_pdf_object.get_data_from_mysql()
pool = multiprocessing.Pool(multiprocessing_count())
for recover_data_list in range(len(recover_data[0])):
pdf = pool.map(class_pdf_object.mysql_to_pdf_data,recover_data[0])
pool.close()
pool.join()
pdf_object.output('savefile.pdf','F')
In the above program, pdf_object is creating empty pdf file as the object in class needs to be passed for output. But, recover_data contains a list and each value is parsing and returning different object of pyfpdf. How should I create single output file. Any help would be appreciated. I know it can be done with the help pdf_object('savefile.pdf','S') as it return document as byteString.
The text was updated successfully, but these errors were encountered:
In the above program, pdf_object is creating empty pdf file as the object in class needs to be passed for output. But, recover_data contains a list and each value is parsing and returning different object of pyfpdf. How should I create single output file. Any help would be appreciated. I know it can be done with the help pdf_object('savefile.pdf','S') as it return document as byteString.
The text was updated successfully, but these errors were encountered: