-
Notifications
You must be signed in to change notification settings - Fork 561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add usePageCss option, add toCanvasList and toImage method for large html #473
base: master
Are you sure you want to change the base?
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 ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #473 +/- ##
==========================================
+ Coverage 62.93% 63.10% +0.17%
==========================================
Files 10 10
Lines 580 580
Branches 143 143
==========================================
+ Hits 365 366 +1
Misses 151 151
+ Partials 64 63 -1 ☔ View full report in Codecov by Sentry. |
…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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are accessibility issues in these changes.
src/util.ts
Outdated
): Promise<string> { | ||
const xmlns = 'http://www.w3.org/2000/svg' | ||
const svg = document.createElementNS(xmlns, 'svg') | ||
const foreignObject = document.createElementNS(xmlns, 'foreignObject') | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are accessibility issues in these changes.
src/util.ts
Outdated
): Promise<string> { | ||
const xmlns = 'http://www.w3.org/2000/svg' | ||
const svg = document.createElementNS(xmlns, 'svg') | ||
const foreignObject = document.createElementNS(xmlns, 'foreignObject') | ||
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image is missing a text alternative. This is a problem for people using screen readers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are accessibility issues in these changes.
src/util.ts
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
…arge amount of sub nodes
Description
Motivation and Context
Types of changes
Self Check before Merge