0

I'm trying to implement a paste event on Angular 7. I copied an Image with transparent background from windows app such as Powerpoint and pasted it in web app. I noticed that image loses the transparent background I've provided what I've done so far

handlePaste(event: any) {
 let reader = new FileReader();
 reader.readAsDataURL(event.clipboardData.files[0]);
 //approach 1
  reader.onload = (rdr) => {
    console.log(reader.result);
  }
  //approach 2
  reader.onload = (evt: any) => {
   console.log(evt.target.result);
  };
}

Is there anyway to maintain the transparent background on an image Thanks in advance

  • Transparency in Windows is a rather iffy subject to begin with. I dug into that a while ago, but... it's a mess. I answered two questions ([this one](https://stackoverflow.com/a/46400011/395685) and [this one](https://stackoverflow.com/a/46424800/395685)) on that subject, and while the questions were about c#, the answers contain all details on how the clipboard works, and why transparency on it is messy. I hope that helps you out. – Nyerguds Aug 01 '19 at 08:34
  • Thanks for the suggestions, but I found difficulty to understand your code on C# since I'm not familiar with that. I'm looking for some answers about how to manage the clipboard data in Javascript/Typescript – Ganesh Arasapaharan Aug 01 '19 at 12:01
  • Well, I wasn't referring to the code. I was saying that everything _else_ I wrote in these answers is worth reading to understand the problems concerning image transparency on the windows clipboard. How to apply that knowledge to Javascript is still your own problem... – Nyerguds Aug 01 '19 at 12:51

0 Answers0