Last active
November 26, 2019 02:19
-
-
Save rogeriotaques/2c9001a56e8af430181cc09a24758e25 to your computer and use it in GitHub Desktop.
Converts a PDF file to base64 string.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getFileInfo(evt: any): void { | |
const reader: FileReader = new FileReader(); | |
const files: Array<any> = evt.target.files || evt.dataTransfer.files; | |
reader.addEventListener( | |
'load', | |
() => { | |
this.form.file_path = reader.result; | |
}, | |
false | |
); | |
if (files[0]) { | |
reader.readAsDataURL(files[0]); | |
} | |
} // getFileInfo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment