feat: add usePageCss option, add toCanvasList and toImage method for large html#473
feat: add usePageCss option, add toCanvasList and toImage method for large html#473hzsrc wants to merge 21 commits intobubkoo:masterfrom
Conversation
…rge amount of sub nodes
|
👋 @hzsrc 💖 Thanks for opening this pull request! 💖 Please follow the contributing guidelines. And we use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #473 +/- ##
==========================================
+ Coverage 62.93% 66.50% +3.57%
==========================================
Files 10 10
Lines 580 612 +32
Branches 143 150 +7
==========================================
+ Hits 365 407 +42
+ Misses 151 144 -7
+ Partials 64 61 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…ed to 1px, but in <img src="svg"> it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px.
|
|
||
| svg.setAttribute('width', `${width}`) | ||
| svg.setAttribute('height', `${height}`) | ||
| // fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in <img src="svg"> it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px. |
There was a problem hiding this comment.
This image is missing a text alternative. This is a problem for people using screen readers.
…ation of canvas size, so this can export a very large htm. And use a ``getMaxCanvasHeight` method to raise the canvas size limit from 16384 to 65535(Chrome) or 32767(Firefox)
|
|
||
| svg.setAttribute('width', `${width}`) | ||
| svg.setAttribute('height', `${height}`) | ||
| // fix: if ratio=2 and style.border='1px', in html it is actually rendered to 1px, but in <img src="svg"> it is rendered to 2px. Then height is different and the bottom 1px is lost, 10 nodes will lost 10px. |
There was a problem hiding this comment.
This image is missing a text alternative. This is a problem for people using screen readers.
| return urlToImg(url).then(function(img: HTMLImageElement): Promise<HTMLImageElement> | HTMLImageElement { | ||
| var ctx = get2dCtx(1, BCheckHeight) | ||
| ctx.drawImage(img, Math.floor(img.width / 2), img.height - BCheckHeight, 1, BCheckHeight, 0, 0, 1, BCheckHeight) | ||
| //win.document.write(i + '<img src="' + ctx.canvas.toDataURL() + '" style="width:10px" />'); //debug |
There was a problem hiding this comment.
This image is missing a text alternative. This is a problem for people using screen readers.
This will fix some problems that the last page of exported pdf is truncated.
`usePageCss` option is default set to 'true'.
…arge amount of sub nodes
Description
Motivation and Context
Types of changes
Self Check before Merge