I’m integrating modular UI.
and i need to do lot of customization
1.how can i access DOM element like document.getElementById(“decreaseFont”) inside pdftron.
2. i also have some dynamic html with its own script tag and and css e.g.,
this is the html i am receiving from an api response and need to render on webviewer i am able to render this html but this scripts are not working.
<script>
document.addEventListener("DOMContentLoaded", function () {{
const image = document.getElementById("main_img");
const zoomInBtn = document.querySelector(".zoom-plus");
const zoomOutBtn = document.querySelector(".zoom-minus");
const resetBtn = document.querySelector(".zoom-reset");
let defaultWidth = image.clientWidth; // Store default width
let currentWidth = defaultWidth;
let minWidth = 50;
zoomInBtn.addEventListener("click", () => {{
currentWidth += 80; // Increase width by 80px
image.style.width = currentWidth + "px";
}});
zoomOutBtn.addEventListener("click", () => {{
if (currentWidth > defaultWidth) {{ // Prevent shrinking too much
currentWidth -= 80;
image.style.width = currentWidth + "px";
}}
}});
resetBtn.addEventListener("click", () => {{
currentWidth = defaultWidth; // Reset to default width
image.style.width = currentWidth + "px";
}});
}});
</script>