1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Merge branch 'master' of github.com:mozilla/pdf.js into fallback-ui

Conflicts:
	extensions/firefox/components/PdfStreamConverter.js
This commit is contained in:
Brendan Dahl 2012-05-24 14:01:10 -07:00
commit 2da12930a6
43 changed files with 1052 additions and 179 deletions

View file

@ -320,19 +320,19 @@ var Page = (function PageClosure() {
* `PDFDocument` objects on the main thread created.
*/
var PDFDocument = (function PDFDocumentClosure() {
function PDFDocument(arg, callback) {
function PDFDocument(arg, password) {
if (isStream(arg))
init.call(this, arg);
init.call(this, arg, password);
else if (isArrayBuffer(arg))
init.call(this, new Stream(arg));
init.call(this, new Stream(arg), password);
else
error('PDFDocument: Unknown argument type');
}
function init(stream) {
function init(stream, password) {
assertWellFormed(stream.length > 0, 'stream must have data');
this.stream = stream;
this.setup();
this.setup(password);
this.acroForm = this.catalog.catDict.get('AcroForm');
}
@ -423,11 +423,12 @@ var PDFDocument = (function PDFDocumentClosure() {
}
// May not be a PDF file, continue anyway.
},
setup: function PDFDocument_setup(ownerPassword, userPassword) {
setup: function PDFDocument_setup(password) {
this.checkHeader();
var xref = new XRef(this.stream,
this.startXRef,
this.mainXRefEntriesOffset);
this.mainXRefEntriesOffset,
password);
this.xref = xref;
this.catalog = new Catalog(xref);
},