Skip to content

Commit

Permalink
Merge pull request #1155 from data-for-change/dev
Browse files Browse the repository at this point in the history
merge dev into master
  • Loading branch information
atalyaalon authored Oct 31, 2024
2 parents 415b5d9 + 701c06c commit e51f015
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/services/to-image.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ export const widgetToImageH2I = (fileName: string, widgetElement: HTMLElement) =
};

// https://github.com/bubkoo/html-to-image
const usingHtml2Image = (fileName: string, widgetElement: HTMLElement) => {
const usingHtml2Image = (fileName: string, widgetElement: HTMLElement, scale = DEFAULT_SCALE) => {
const canvasWidth = widgetElement.offsetWidth * scale;
const canvasHeight = widgetElement.offsetHeight * scale;

htmlToImage.toPng(widgetElement)
htmlToImage.toPng(widgetElement, {
canvasWidth,
canvasHeight,
})
.then(function (blob: any) {
saveAs(blob, `${fileName}.png`);
});
Expand Down

0 comments on commit e51f015

Please sign in to comment.