aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/pages/sheet-map/download-map-pdf-page-content.html
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-07-13 23:32:26 +0530
committerGitHub <noreply@github.com>2026-07-13 23:32:26 +0530
commitce401d03e75bcbfd1cdfa963954e0807219fb80d (patch)
tree52a813c1705a952312c20c328b00fa845a3453f9 /src/scripts/pages/sheet-map/download-map-pdf-page-content.html
parent98e7019c61ea0ffe344ef7ce809d38d62254a9fc (diff)
parentdfba7ff6fff7bde33b40a343a2318b35c429b40f (diff)
downloadbanglar-bhumi-utils-ce401d03e75bcbfd1cdfa963954e0807219fb80d.tar.gz
banglar-bhumi-utils-ce401d03e75bcbfd1cdfa963954e0807219fb80d.zip
Merge pull request #6 from arpitchakladar/adding-documentation-comments
Adding documentation comments
Diffstat (limited to 'src/scripts/pages/sheet-map/download-map-pdf-page-content.html')
-rw-r--r--src/scripts/pages/sheet-map/download-map-pdf-page-content.html87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/scripts/pages/sheet-map/download-map-pdf-page-content.html b/src/scripts/pages/sheet-map/download-map-pdf-page-content.html
new file mode 100644
index 0000000..da765ec
--- /dev/null
+++ b/src/scripts/pages/sheet-map/download-map-pdf-page-content.html
@@ -0,0 +1,87 @@
+<style>
+ body {
+ margin: 0;
+ padding: 0;
+ }
+ svg {
+ display: block;
+ max-width: 100%;
+ max-height: 100%;
+ }
+ text {
+ font-family: "BNB-TTBidisha", sans-serif;
+ font-weight: bold;
+ font-size: 2;
+ fill: blue;
+ text-anchor: middle;
+ }
+ path {
+ fill-rule: evenodd;
+ fill: #ffcc66;
+ fill-opacity: 0.8;
+ stroke: #cc6633;
+ stroke-opacity: 0.8;
+ stroke-width: 0.2;
+ stroke-linecap: round;
+ stroke-linejoin: round;
+ }
+ .details {
+ font-size: 1.3rem;
+ display: flex;
+ width: 100%;
+ padding: 0 1rem 1rem 1rem;
+ border-bottom: 2px solid black;
+ justify-content: space-around;
+ margin-bottom: 0.2rem;
+ }
+</style>
+<div class="details">
+ <div>
+ DISTRICT: $district$
+ </div>
+ <div>
+ BLOCK: $block$
+ </div>
+ <div>
+ MOUZA: $mouza$
+ </div>
+</div>
+<svg>
+ $mapContent$
+</svg>
+<script>
+ let minx = Infinity;
+ let miny = Infinity;
+ let maxx = 0;
+ let maxy = 0;
+ const paths = document.querySelectorAll("path");
+
+ for (const p of paths) {
+ const b = p.getBBox();
+ minx = b.x < minx ? b.x : minx;
+ miny = b.y < miny ? b.y : miny;
+ maxx = maxx < b.x + b.width ? b.x + b.width : maxx;
+ maxy = maxy < b.y + b.height ? b.y + b.height : maxy;
+ }
+
+ for (const p of paths) {
+ const m = "M " + p.getAttribute("d").substr(2).split(",").map(cood => {
+ cood = cood.trim().split(" ");
+ return cood[0] + " " + (miny + maxy - parseFloat(cood[1])).toString();
+ }).join(", ");
+ p.setAttribute("d", m);
+ }
+
+ for (const t of document.querySelectorAll("text")) {
+ t.setAttribute("y", (miny + maxy - parseFloat(t.getAttribute("y"))).toString());
+ }
+
+ document.querySelector("svg")
+ .setAttribute(
+ "viewBox",
+ [minx, miny, maxx - minx, maxy - miny]
+ .map(e => e.toString()).join(" ")
+ );
+ window.addEventListener("afterprint", window.close);
+ window.print();
+</script>