Merge branch 'master' of github.com:mozilla/pdf.js into textsearch

This commit is contained in:
Artur Adib 2012-05-16 12:51:19 -04:00
commit 0bac4abcb5
22 changed files with 675 additions and 78 deletions

View file

@ -8,10 +8,12 @@
* e.g. No cross domain requests without CORS.
*
* @param {string|TypedAray} source Either a url to a PDF is located or a
* typed array already populated with data.
* typed array (Uint8Array) already populated with data.
* @param {Object} headers An object containing the http headers like this:
* { Authorization: "BASIC XXX" }.
* @return {Promise} A promise that is resolved with {PDFDocumentProxy} object.
*/
PDFJS.getDocument = function getDocument(source) {
PDFJS.getDocument = function getDocument(source, headers) {
var promise = new PDFJS.Promise();
var transport = new WorkerTransport(promise);
if (typeof source === 'string') {
@ -29,7 +31,8 @@ PDFJS.getDocument = function getDocument(source) {
error: function getPDFError(e) {
promise.reject('Unexpected server response of ' +
e.target.status + '.');
}
},
headers: headers
},
function getPDFLoad(data) {
transport.sendData(data);