mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Don't traverse all pages to get a single page.
This commit is contained in:
parent
516d2e79be
commit
c2d65fc4ab
8 changed files with 183 additions and 84 deletions
|
@ -187,6 +187,14 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
|||
getPage: function PDFDocumentProxy_getPage(number) {
|
||||
return this.transport.getPage(number);
|
||||
},
|
||||
/**
|
||||
* @param {object} Must have 'num' and 'gen' properties.
|
||||
* @return {Promise} A promise that is resolved with the page index that is
|
||||
* associated with the reference.
|
||||
*/
|
||||
getPageIndex: function PDFDocumentProxy_getPageIndex(ref) {
|
||||
return this.transport.getPageIndex(ref);
|
||||
},
|
||||
/**
|
||||
* @return {Promise} A promise that is resolved with a lookup table for
|
||||
* mapping named destinations to reference numbers.
|
||||
|
@ -861,6 +869,16 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
return promise;
|
||||
},
|
||||
|
||||
getPageIndex: function WorkerTransport_getPageIndexByRef(ref) {
|
||||
var promise = new PDFJS.Promise();
|
||||
this.messageHandler.send('GetPageIndex', { ref: ref },
|
||||
function (pageIndex) {
|
||||
promise.resolve(pageIndex);
|
||||
}
|
||||
);
|
||||
return promise;
|
||||
},
|
||||
|
||||
getAnnotations: function WorkerTransport_getAnnotations(pageIndex) {
|
||||
this.messageHandler.send('GetAnnotationsRequest',
|
||||
{ pageIndex: pageIndex });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue