i'm generating a pdf file from react page by capturing react components then converting them to image using dom-to-image library then putting them inside pdf ,it's working well , the problem is when having a lot of markers the code respond with request timeout error ,it appears that he is trying to capture every marker in the map and that causing the problem , so any solution to this problem or alternatives that may help ?
map image

const commercesNode = document.getElementById("commerces");
const commerces = await domtoimage.toPng(commercesNode, {
width: commercesNode.clientWidth * scale,
height: commercesNode.clientHeight * scale,
style: {
transform: "scale(" + scale + ")",
transformOrigin: "top left",
},
});
imgarray.push({
img: commerces,
name: "commerces"
});