Reputation: 7249
I am using dom-to-image lib in order to export DOM to blob from which I create PDF docs.
Problem is that there is need approximately 25 seconds for the function to finish.
Is there is any known way how dom-to-image can be optimised?
let map = document.getElementById('map');
domtoimage.toBlob(map).then(imageBlob => {
ExportTools.exportService.getPDF(imageBlob, eventData);
});
An exported picture is big almost 1920px in width and there is a lot of white space.
Upvotes: 0
Views: 1994
Reputation: 363
From my experience with dom-to-image, it is taking a lot of time for XHR requests to apply fonts. If the fonts you used are not very important, try my forked version out of dom-to-image and see if it works for you. I could reduce the loading time to 2 seconds from 15-20seconds. The images I'm exporting are around 1500px wide too.
Try including this forked version in your project: https://github.com/venkat4541/dom-to-image
Upvotes: 1