diff --git a/backend/routers/fileStorage.py b/backend/routers/fileStorage.py index 38b6a489..dfda73cf 100644 --- a/backend/routers/fileStorage.py +++ b/backend/routers/fileStorage.py @@ -1,3 +1,4 @@ +from textwrap import wrap from fastapi import APIRouter, HTTPException, File, UploadFile, Form from fastapi.responses import FileResponse, JSONResponse import requests @@ -28,6 +29,7 @@ class minioDeleteRequest(BaseModel): class medCertUploud(BaseModel): app_id: str fullName: str + id_no: str docfname: str busName: str busAddr: str @@ -177,13 +179,18 @@ def generateMedCertPDF(requestItem: medCertUploud): #Body myCanvas.setFont('Helvetica', 12) - line1 = "This is to certify that " + requestItem.fullName.upper() + " was seen by " + requestItem.docfname.upper() + " on " + requestItem.startDate + "." - line2 = "He/She is unfit to attend work/school from " + requestItem.startDate + " up to and including " + requestItem.endDate + "." - line3 = "He/She will return on " + requestItem.returnDate + "." + body = "" + body += "This is to certify that " + requestItem.fullName.upper() + " (" + requestItem.id_no+ ") was seen by " + requestItem.docfname.upper() + " on " + requestItem.startDate + "." + body += "\nHe/She is unfit to attend work/school from " + requestItem.startDate + " up to and including " + requestItem.endDate + "." + body += "\nHe/She will return on " + requestItem.returnDate + "." - myCanvas.drawString(50, h-250,line1) - myCanvas.drawString(50, h-280,line2) - myCanvas.drawString(50, h-310,line3) + y = 250 + for line in wrap(body, 90): + myCanvas.drawString(50, h-y, line) + y += 30 + # myCanvas.drawString(50, h-250,line1) + # myCanvas.drawString(50, h-280,line2) + # myCanvas.drawString(50, h-310,line3) #Signature myCanvas.drawImage(imageSig, 50, h - 690,100,100) diff --git a/backend/temp.pdf b/backend/temp.pdf index 591fe56c..e84c67d0 100644 --- a/backend/temp.pdf +++ b/backend/temp.pdf @@ -66,7 +66,7 @@ endobj endobj 10 0 obj << -/Author (anonymous) /CreationDate (D:20240820103956+00'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20240820103956+00'00') /Producer (ReportLab PDF Library - www.reportlab.com) +/Author (anonymous) /CreationDate (D:20240820123153+00'00') /Creator (ReportLab PDF Library - www.reportlab.com) /Keywords () /ModDate (D:20240820123153+00'00') /Producer (ReportLab PDF Library - www.reportlab.com) /Subject (unspecified) /Title (untitled) /Trapped /False >> endobj @@ -77,10 +77,10 @@ endobj endobj 12 0 obj << -/Filter [ /ASCII85Decode /FlateDecode ] /Length 725 +/Filter [ /ASCII85Decode /FlateDecode ] /Length 744 >> stream -Gas2H>u03/'Sc)J/'d72<7c<[f]gq:V?2STUINsSlI]m\,\BV/"M]C\>/2]n--DRFkC&E;3@9:T6,ot.!R;BQ(Bb!IAUuPR5[?[QU;%;VGWXO73qtjTH5q)d%,dg8p4e`_h^(>JAbtKU2'IDS_%HXb&ff%[a(2(J]gN4"n`haaT3Ps1#f/[#ar=;:5bi(>rRBLFTZ7oSBg/PhLQ`9:XH<:*`TRIE-lf8\@fuB1%1bkVLd82bjWpXTPIqkD&X]\StnY0>`oIN?*;GF]4l*7&*eGtS#1^+fD_1]HL4r@[WQ`.L<[UqdEhAdX>WN#r-B,mMq.DYh((o3-a90=5]Ln_"6NRIqXtX<:27s1hrkk.ufHdCJ@^-=%-q^/]J5g8kJcd&O$tm4LU6^LkHh93cBcFr%kH.U;.p?rrHCX3e.~>endstream +Gas2H>u03/'Sc)J/']F`e[6DZG'Z$=WMm`BUINr@2lU;jg%)tBFGTnl3GG0>Zr8136h^,ca6+EU_!WDaW(VXk"lgI$6:"`s$o(SfOJq)]5VV'?F\e#`O9eDq9=HAfcg%D*?EXosNPM!:b_Cf:Lo+GHct[DONX9&!R+B*_@*kPV1hb7,K)82aAf/FA1*2"bA1OBH3*W2TR=I&0#PUr0o>8;Udc[9PK"C_B#[)t.lj,pIHbs?[25Y4#tn/=6$`\./1"kr(DH";<+#K1oXkWMPZJdf)Z1IP='^m$+^_oYliV*9Y=9b[$k_CBM'P$);7UA%gO0BU$9\EhWIBr'u/:)t<.GgJ#*p]lKEh*tbD43)dm^4hmU&VUc,3?'7<9q1#GBYq.Jb]Z/3pf0Y9*P&#GI.*^noV=`J6O9CrcAW'Ba_$t's(_MqLB&f6X:_Y<%i[009g_e#H3i+4Ia"nf1!c%p!4)5Q~>endstream endobj xref 0 13 @@ -100,7 +100,7 @@ xref trailer << /ID -[<00ce46e2306ec8472bf4c2eac2b557f1><00ce46e2306ec8472bf4c2eac2b557f1>] +[<754aaa07bf5a4b3e2ac9c40895813549><754aaa07bf5a4b3e2ac9c40895813549>] % ReportLab generated PDF document -- digest (http://www.reportlab.com) /Info 10 0 R @@ -108,5 +108,5 @@ trailer /Size 13 >> startxref -688251 +688270 %%EOF