diff --git a/generatePDF.py b/generatePDF.py index 847b286..bce0ee1 100644 --- a/generatePDF.py +++ b/generatePDF.py @@ -83,19 +83,26 @@ def generatePDF(save_path,project,DBP,MBP,SBP,PP,Q_avg,txt1,txt2): pdf.set_title(title) pdf.set_author('Aloma Blanch Granada') - pdf.print_section(1, 'Cehcking convergency and periodicity') - pdf.image(save_path +'/Log_Last_nonlin_res_error.jpg', x = None, y = None, w = 140, h = 100, type = '', link = '') - pdf.image(save_path +'/periodicity.jpg', x = None, y = None, w = 140, h = 100, type = '', link = '') - pdf.cell(0, 10,txt1[0], 0, 1) - pdf.cell(0, 10,txt1[1], 0, 1) - pdf.cell(0, 10,txt1[2], 0, 1) + pdf.print_section(1, 'Checking convergency and periodicity') + pdf.image(save_path +'/Log_Last_nonlin_res_error.jpg', x = 40, y = None, w = 140, h = 100, type = '', link = '') + pdf.image(save_path +'/periodicity.jpg', x = 40, y = None, w = 140, h = 100, type = '', link = '') + pdf.set_font('Arial', '', 10) + pdf.cell(0, 10,' ', 0, 1) + pdf.cell(0, 5,txt1[0], 0, 1) + pdf.cell(0, 5,txt1[1], 0, 1) + pdf.cell(0, 5,txt1[2], 0, 1) + pdf.cell(0, 5,txt1[3], 0, 1) + pdf.cell(0, 5,txt1[4], 0, 1) - pdf.print_section(2, 'Cehcking Pressures at each outlet') - pdf.image(save_path +'/pressure.jpg', x = None, y = None, w = 140, h = 100, type = '', link = '') + pdf.print_section(2, 'Checking Pressures at each outlet') + pdf.image(save_path +'/pressure.jpg', x = 40, y = None, w = 140, h = 100, type = '', link = '') width_cell=[20,30,30,30,30,30,30]; - # pfd.SetFillColor(193,229,252); # Background color of header + # pfd.SetFillColor(193,229,252); # Background color of header + pdf.set_font('Times', '', 10) # Header starts + pdf.cell(0, 25,' ', 0, 1) + pdf.set_x(35) pdf.cell(width_cell[0],10,'ROI',1,0,'C') # First header column pdf.cell(width_cell[1],10,'DBP [mmHg]',1,0,'C') # Second header column pdf.cell(width_cell[2],10,'MBP [mmHg]',1,0,'C') # Third header column @@ -103,6 +110,7 @@ def generatePDF(save_path,project,DBP,MBP,SBP,PP,Q_avg,txt1,txt2): pdf.cell(width_cell[4],10,'PP [mmHg]',1,1,'C') # Fourth header column # Rows for i in range(0,len(SBP)): + pdf.set_x(35) pdf.cell(width_cell[0],10,'ROI-'+ str(i+2),1,0,'C') # First column of row 1 pdf.cell(width_cell[1],10,str(round(DBP[i],2)),1,0,'C') # Second column of row 1 pdf.cell(width_cell[2],10,str(round(MBP[i],2)),1,0,'C') # Third column of row 1 @@ -110,21 +118,26 @@ def generatePDF(save_path,project,DBP,MBP,SBP,PP,Q_avg,txt1,txt2): pdf.cell(width_cell[4],10,str(round(PP[i],2)),1,1,'C') # Fourth column of row 1 - pdf.print_section(3, 'Cehcking Flow Rate at each outlet') - pdf.image(save_path +'/flow.jpg', x = None, y = None, w = 140, h = 100, type = '', link = '') + pdf.print_section(3, 'Checking Flow Rate at each outlet') + pdf.image(save_path +'/flow.jpg', x = 40, y = None, w = 140, h = 100, type = '', link = '') - width_cell=[20,60]; - # pfd.SetFillColor(193,229,252); # Background color of header + width_cell=[20,45]; + # pfd.SetFillColor(193,229,252); # Background color of header + pdf.set_font('Times', '', 10) # Header starts + pdf.cell(0, 25,' ', 0, 1) + pdf.set_x(80) pdf.cell(width_cell[0],10,'ROI',1,0,'C') # First header column pdf.cell(width_cell[1],10,'Average Flow rate [mL/s]',1,1,'C') # Second header column # Rows for i in range(0,len(Q_avg)): + pdf.set_x(80) pdf.cell(width_cell[0],10,'ROI-'+ str(i+2),1,0,'C') pdf.cell(width_cell[1],10,str(round(Q_avg[i],2)),1,1,'C') - pdf.print_section(4, 'Cehcking Inlet Flow Waveform and time steps saved') - pdf.image(save_path +'/inlet_waveform.jpg', x = None, y = None, w = 140, h = 100, type = '', link = '') - pdf.cell(0, 10,txt2, 0, 1) + pdf.print_section(4, 'Checking Inlet Flow Waveform and time steps saved') + pdf.image(save_path +'/inlet_waveform.jpg', x = 40, y = 50, w = 140, h = 100, type = '', link = '') + pdf.set_font('Arial', '', 10) + pdf.cell(0, 5,txt2, 0, 1) pdf.output(save_path + '/' + project + '-report.pdf', 'F') \ No newline at end of file