Getting binary (base64) data from HTML5 Canvas (readAsBinaryString)

The canvas element provides a toDataURL method which returns a data: URL that includes the base64-encoded image data in a given format. For example: var jpegUrl = canvas.toDataURL(“image/jpeg”); var pngUrl = canvas.toDataURL(); // PNG is the default Although the return value is not just the base64 encoded binary data, it’s a simple matter to trim … Read more

How do I download a file with Angular2 or greater

The problem is that the observable runs in another context, so when you try to create the URL var, you have an empty object and not the blob you want. One of the many ways that exist to solve this is as follows: this._reportService.getReport().subscribe(data => this.downloadFile(data)),//console.log(data), error => console.log(‘Error downloading the file.’), () => console.info(‘OK’); … Read more

tech