diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/scripts/functionality/view-khatian/download-document-content.ts | 5 | ||||
| -rw-r--r-- | src/shared/download-pdf.ts | 26 |
2 files changed, 11 insertions, 20 deletions
diff --git a/src/scripts/functionality/view-khatian/download-document-content.ts b/src/scripts/functionality/view-khatian/download-document-content.ts index 594db5e..249e2b1 100644 --- a/src/scripts/functionality/view-khatian/download-document-content.ts +++ b/src/scripts/functionality/view-khatian/download-document-content.ts @@ -17,11 +17,8 @@ export default (isPlotInformation: boolean, details: string, { district, block, #content { width: 100%; - min-height: calc(100vw * 1.4); margin: 0; padding: 0; - display: flex; - flex-direction: column; } .banner { @@ -189,7 +186,7 @@ export default (isPlotInformation: boolean, details: string, { district, block, .footer { width: 100%; - margin-top: auto; + margin-top: 1rem; } </style> <img class="banner" src="https://banglarbhumi.gov.in/BanglarBhumi/images/bl.png"> diff --git a/src/shared/download-pdf.ts b/src/shared/download-pdf.ts index e741942..bd8f815 100644 --- a/src/shared/download-pdf.ts +++ b/src/shared/download-pdf.ts @@ -1,23 +1,17 @@ -const autoPrintCode = ` -<script> - document.addEventListener("DOMContentLoaded", () => { - Promise.all(Array.from(document.images) - .filter(img => !img.complete) - .map(img => new Promise(resolve => { - img.onload = img.onerror = resolve; - }))).then(() => { - window.print(); - window.close(); - }); - }); -</script> -`; - export const downloadPDF = (content: string) => { const tab = window.open("about:blank", "_blank"); if (tab) { - tab.document.write(content + autoPrintCode); + tab.document.write(content); tab.document.close(); + tab.focus(); + Promise.all(Array.from(tab.document.images) + .filter(img => !img.complete) + .map(img => new Promise(resolve => { + img.onload = img.onerror = resolve; + }))).then(() => { + tab.print(); + tab.close(); + }); } }; |
