Skip to content
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

Is there any way to block some elements in a document from rendering ? #132

Open
prakash-chokalingam opened this issue Mar 3, 2016 · 2 comments

Comments

@prakash-chokalingam
Copy link

Like html2canvas does with with data-attribute 'data-html2canvas-ignore=true'.

@cburgmer
Copy link
Owner

cburgmer commented Mar 3, 2016

No, and probably not easy to implement, because we delegate the whole rendering process to the browser itself. On a per use case basis, you could try replacing the given element with a dummy element.
However I don't see an easy generic way to implement that here.

Alternatively, if this works for you, you could try measuring the element in question (offset top/left + width/height) and blank out this space retroactively.

@cburgmer
Copy link
Owner

A more technical answer to my initial response: In an interim step we inspect the size of the document being rendered via its HTML being pasted into a hidden iframe. However, the final result lives inside a <foreignObject> blob inside an SVG where position and size seem to be slightly different, when rendered by the browser. From that perspective I doubt whether we can implement an overlay mechanism to retrospectively hide certain elements based on their position.

However, here's a different idea: the element could just have it's style attribute overridden with opacity: 0. Hopefully this would hide any possible combination of content. This will however not allow replacing the element with arbitrary surfaces (like say black). If anybody feels compelled to give it a try, happy to lend a hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants