Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Get the document
- var xmlhttp=new XMLHttpRequest();
- xmlhttp.open("GET","../../documents/get_document.php",false);
- xmlhttp.send();
- var pdf_document = xmlhttp.responseText;
- var DEFAULT_URL = 'data:application/pdf;base64,' + pdf_document;
- function base64ToUint8Array(base64) {
- var raw = atob(base64); //This is a native function that decodes a base64-encoded string.
- var uint8Array = new Uint8Array(new ArrayBuffer(raw.length));
- for(var i = 0; i < raw.length; i++) {
- uint8Array[i] = raw.charCodeAt(i);
- }
- return uint8Array;
- }
- //Get the document
- var xmlhttp=new XMLHttpRequest();
- xmlhttp.open("GET","../../documents/get_document.php",false);
- xmlhttp.send();
- var pdf_document = xmlhttp.responseText;
- var DEFAULT_URL = base64ToUint8Array(pdf_document);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement