Upload pdf file to firebase storage

189 views
Skip to first unread message

Den

unread,
Sep 11, 2017, 10:55:27 AM9/11/17
to Firebase Google Group
My example:

var storageRef =  firebaseService.storage.ref().child('strg');
var contentText = 'Anything text with spaces and line wrapping';
var contentHTML = '<span><h1>Any html text with tables</h1></span>';

//I tried all this variants
//1)
var blob = new Blob([$.base64('encode', "Hello world")], {type:"application/pdf;charset=UTF-8"});
//2)
var blob = new Blob([contentText], {type:"application/pdf;charset=UTF-8"});
//3)
var blob = new Blob([contentHTML], {type:"application/pdf;charset=UTF-8"});
//for 1,2,3
storageRef.child('test.pdf').put(blob, {contentType: 'application/pdf'});


//4)
var blob = new Blob([contentText], {type:"application/pdf;charset=UTF-8"});
var file = new File([blob], "test.pdf");
//for 4)
storageRef.child('test.pdf').put(file, {contentType: 'application/pdf'});

In the issue a file uploaded, but he not opens from Adobe Acrobat.
But if are open him from text editor, then content outputted.

Please, help
Reply all
Reply to author
Forward
0 new messages