From da1953dea1a83d4f0bb4059401eb83c103ad46aa Mon Sep 17 00:00:00 2001 From: hzsrc Date: Mon, 13 Jan 2025 15:32:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AB=98=E5=BA=A6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/util.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9901851b..db356873 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "html-to-image-big", - "version": "1.11.12", + "version": "1.11.13", "description": "Generates an image from a DOM node using HTML5 canvas and SVG. Support big html page.", "main": "lib/index.js", "module": "es/index.js", diff --git a/src/util.ts b/src/util.ts index 055bf962..bc4c93e4 100644 --- a/src/util.ts +++ b/src/util.ts @@ -341,7 +341,8 @@ export async function nodeToDataURL( const svg = document.createElementNS(xmlns, 'svg') const foreignObject = document.createElementNS(xmlns, 'foreignObject') // add a tail for check ending - const heightWithTail = height + TailHeight * 2 + let heightWithTail = height + if (opt.checkTail) heightWithTail += TailHeight * 2 // fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in i it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px. const ratio = getPixelRatio() svg.setAttribute('width', `${width / ratio}`)