Merge pull request #532 from kkujala/master
Use data directly in PDFDoc.
This commit is contained in:
commit
65cad1caf8
3
pdf.js
3
pdf.js
@ -3800,7 +3800,8 @@ var Catalog = (function catalogCatalog() {
|
||||
})();
|
||||
|
||||
var PDFDoc = (function pdfDoc() {
|
||||
function constructor(stream) {
|
||||
function constructor(data) {
|
||||
var stream = new Stream(data);
|
||||
assertWellFormed(stream.length > 0, 'stream must have data');
|
||||
this.stream = stream;
|
||||
this.setup();
|
||||
|
@ -83,7 +83,7 @@ function nextTask() {
|
||||
r.responseArrayBuffer || r.response;
|
||||
|
||||
try {
|
||||
task.pdfDoc = new PDFDoc(new Stream(data));
|
||||
task.pdfDoc = new PDFDoc(data);
|
||||
} catch (e) {
|
||||
failure = 'load PDF doc : ' + e.toString();
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ var PDFView = {
|
||||
while (container.hasChildNodes())
|
||||
container.removeChild(container.lastChild);
|
||||
|
||||
var pdf = new PDFDoc(new Stream(data));
|
||||
var pdf = new PDFDoc(data);
|
||||
var pagesCount = pdf.numPages;
|
||||
document.getElementById('numPages').innerHTML = pagesCount;
|
||||
|
||||
|
@ -48,7 +48,7 @@ addEventListener('message', function(event) {
|
||||
var data = event.data;
|
||||
// If there is no pdfDocument yet, then the sent data is the PDFDocument.
|
||||
if (!pdfDocument) {
|
||||
pdfDocument = new PDFDoc(new Stream(data));
|
||||
pdfDocument = new PDFDoc(data);
|
||||
postMessage({
|
||||
action: 'pdf_num_pages',
|
||||
data: pdfDocument.numPages
|
||||
|
Loading…
Reference in New Issue
Block a user