mozilla/pdf.js — Issue #844: pdf.js with File API?
Author: zz85
Created: 2011-11-29 11:47:29+00:00
State: open

hello!

just wondering if anyone tried using the cool pdf.js library with the file api?

i managed to load up a pdf via the usual XMLHttpRequest method, but when trying to use it with the File API, I'll get a

`Uncaught Error: Missing endstream` message. could it be due to incompatible binary format when loading from the File API?

my related file loading code as follows:

`
window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder;
window.URL = window.URL || window.webkitURL || window.mozURL;
var reader = new FileReader();
reader.readAsBinaryString( file ); // i tried both readAsBinaryString and readAsText
// on reader.onload
var blob = new BlobBuilder();
blob.append( contents );
var url = URL.createObjectURL( blob.getBlob() );
getPdf(url, callback);

//etc etc..