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

Download Org. chart has issue #400

Open
sandipeq opened this issue May 11, 2024 · 1 comment
Open

Download Org. chart has issue #400

sandipeq opened this issue May 11, 2024 · 1 comment

Comments

@sandipeq
Copy link

Hello Folks!

Can anyone help me out, as I am facing issue while downloading Organization chart which has profile images coming from AWS S3 bucket?

So here is code I am using for download org. chart.

const downloadOrgChart = async () => { try { // setIsDownloading(true); await chart.exportImg({ full: true, save: false, onLoad: (base64) => { let link = document.createElement('a'); link.href = base64; // Append timestamp to URL link.download = ${companyName}-organization-chart + '.png'; // Set the image name with an extension link.click(); // Trigger the download // setIsDownloading(false); } }); } catch (error) { console.log('error: ', error); // setIsDownloading(false); } finally { // setIsDownloading(false); } };

We have added CORS policy in aws s3 bucket. But still facing issue with profile image missing in downloaded org chart. Please refer attached screenshot.

exaqode-organization-chart (15)

Your help is appreciated
Thanks!

@bumbeishvili
Copy link
Owner

Hi, when exporting the chart, we are trying to load images as data URLs (base 64) and probably that's where problem happens.

Most probably problem happens here.

org-chart/src/d3-org-chart.js

Lines 1719 to 1731 in d9334eb

toDataURL(url, callback) {
var xhr = new XMLHttpRequest();
xhr.onload = function () {
var reader = new FileReader();
reader.onloadend = function () {
callback(reader.result);
}
reader.readAsDataURL(xhr.response);
};
xhr.open('GET', url);
xhr.responseType = 'blob';
xhr.send();
}

But of course I'll need interactive reproduced sample to understand what's happening

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

No branches or pull requests

2 participants