diff --git a/src/scenes/Home/utilities/utils.tsx b/src/scenes/Home/utilities/utils.tsx index 8d4adf9c4eaf3dd41bf8f0bfba873d1e3c5b54b2..3eec9cf41c921a43df6b63661bc1ba7a1dd17750 100644 --- a/src/scenes/Home/utilities/utils.tsx +++ b/src/scenes/Home/utilities/utils.tsx @@ -121,6 +121,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri const imgHeight = 130; const pageWidth = 297; const pageHeight = 210; + const imgPieWidth = 212; + const imgPieHeight = 110; + const pageImgWidth = 38; + const pageImgHeight = 30; const marginX = (pageWidth - imgWidth) / 2; @@ -138,7 +142,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri if (key === "Tanggal") doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 24, {align:"center"}); else - doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); + if (chartType) + doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); + else + doc.text("DATA KASUS TBC DEPOK", pageWidth/2, 18, {align:"center"}); } const writeInfoCases = (doc: jsPDF) => { @@ -204,7 +211,7 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri doc.text("Total Keseluruhan : " + total + " Kasus" , pageWidth/2, 155, {align:"center"}) else if (chartType) - doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 140, {align:"center"}) + doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 150, {align:"center"}) else doc.text("Total Keseluruhan : " + total + " Kasus", pageWidth/2, 150, {align:"center"}) } @@ -261,7 +268,10 @@ const image2pdf = (imageType: string, type: string, key: string, dataType: stri if (key === "Tanggal") doc.addImage(png, imageType, marginX, 12, 252, 156, undefined, "SLOW"); else - doc.addImage(png, imageType, marginX, 12, imgWidth, imgHeight, undefined, "SLOW"); + if (chartType) + doc.addImage(png, imageType, pageImgWidth, pageImgHeight, imgPieWidth, imgPieHeight, undefined, "SLOW"); + else + doc.addImage(png, imageType, marginX, 12, imgWidth, imgHeight, undefined, "SLOW"); } const blobToImage = (blob: Blob) => {