Comments (9)
I am facing the exactly same problem right now.
@mask2012 @dkruchok did you solved this, guys?
from dom-to-image-more.
This is a significant issue. There is no need to access the data source within the DOM again. However, you can resolve this issue by using a third-party URL or by setting up your own API server.
Solution
While there is no guaranteed solution, the problem can be resolved by using allOrigins. With allOrigins, you can bypass CORS policies and access the base64 version of the image, allowing the image in the DOM tree to be displayed.
Using allOrigins is simple (fetch or axios doesn't matter):
const base64 = await axios.get(https://api.allorigins.win/get?url=${yourImageURL})
from dom-to-image-more.
That's a really interesting solution, might be able to add an option to pipe all image requests through that automatically (opt-in). Will look into that idea after I do my taxes :)
from dom-to-image-more.
I have the same problem, and what even funny is, the same url, my computer always works fine, and other's always CORS.
Anyone have clue with this?
from dom-to-image-more.
the first pic is the wrong one, and the second is on my computer, which is always fine.
from dom-to-image-more.
I have the same problem, has anyone found a solution? Should I implement a proxy server and put requests through it?
from dom-to-image-more.
Try cacheBust: true
domtoimage.toPng(nodeName, { cacheBust: true })
from dom-to-image-more.
Try cacheBust: true
domtoimage.toPng(nodeName, { cacheBust: true })
Don't work in all cases
from dom-to-image-more.
That's a really interesting solution, might be able to add an option to pipe all image requests through that automatically (opt-in). Will look into that idea after I do my taxes :)
Actually considered the same solution until I noticed the delay caused by image loading :) Therefore, using a third-party URL and rendering all images may not be efficient. In fact, frameworks with server-side functions like Next.js make it quite easy and eliminate the need for this.
It seems like many people are encountering the same issue. With your permission, I would like to add a comment about this topic in the readme file.
from dom-to-image-more.
Related Issues (20)
- youtube video with react player is giving black screen while capturing with domtoimage HOT 2
- Can I use this library without npm or module? Just plain html HOT 2
- On firefox toPng returns empty image HOT 1
- make it posible to shift
- Icon to image display failed HOT 1
- TypeError: Cannot read properties of undefined (reading 'setProperty')
- Error using toPng with extra quote in HTML
- The internal picture is blank HOT 2
- border HOT 10
- Cannot convert webgl
- Need embed fonts to be optional
- Browser crashes when using toPng
- Image is cropped in Firefox HOT 3
- cssRules from google CSS breaking HOT 1
- TypeError:Failed to execute 'readAsDataURL' on 'FileReader' : parameter 1 is not of type 'Blob' HOT 7
- Bug: get wrong pic from image jsp
- domtoimage doesn't work on vector layer
- Exporting blank image when element's parent has visibility hidden
- Dom-to-image conversion results misaligned content in Image for CSS flex styles
- domtoImage converts only first child element when cloneNode(true) is used
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dom-to-image-more.