Copy link to clipboard
Copied
Please share the javascript code for download any image from the adobe illustrator to clipboard.
Copy link to clipboard
Copied
similar to Ctrl+C?
Copy link to clipboard
Copied
I am asking about the code for convert-string-in-base64-to-image-and-save-on-filesystem using javascript
Copy link to clipboard
Copied
that's something else from your original question but ok, can you elaborate? where's the base64 location? can you post a sample?
there's another user asking the for the same thing, are you Rocky@?
Copy link to clipboard
Copied
Location of base64=
</Library/Application Support/Adobe/CEP/extensions/plugin/data.js>
Copy link to clipboard
Copied
this code is not working to download any image from the adobe illustrator.
function base64(imgPath){
const base64string = imgPath;
const pageImage = new Image();
pageImage.src='data:image/png;base64,' + base64string;
pageImage.onload = function() {
const canvas = document.createElement('canvas');
canvas.width = pageImage.naturalWidth;
canvas.height= pageImage.naturalHeight;
const ctx = canvas.getContext('2d');
ctx.imageSmoothingEnabled = false;
ctx.drawImage(pageImage, 0, 0);
saveScreenshot(canvas);
}
}
function saveScreenshot(canvas) {
let fileName = "image"
const link = document.createElement('a');
link.download = fileName + '.png';
canvas.toBlob(function(blob) {
link.href = URL.createObjectURL(blob);
link.click();
});
};