Correct the type of PDFDocumentProxy.numPages and .fingerprint

The type of them is a property, not a function or a method.

Reference:
- API spec: https://github.com/mozilla/pdf.js/blob/305274cd45ed3b4931f983b31ebd4ffb999fb4c6/test/unit/api_spec.js#L45-L50
- Impl: https://github.com/mozilla/pdf.js/blob/816f2f7e1dc604d52bbde29eb9357360dbeddbbe/src/core/core.js#L476 and #L512
This commit is contained in:
Eunchong Yu
2014-04-15 22:45:27 +09:00
parent 67aa15a029
commit ca1766728b
2 changed files with 20 additions and 4 deletions
+18 -2
View File
@@ -3,9 +3,18 @@
//
// Fetch the PDF document from the URL using promises
//
var pdfDoc: PDFDocumentProxy;
var pageNum: number;
PDFJS.getDocument('helloworld.pdf').then(function (pdf) {
// Using promise to fetch the page
pdf.getPage(1).then(function (page) {
pdfDoc = pdf;
pageNum = 1;
renderPage(pageNum);
});
function renderPage(pageNum: number) {
pdfDoc.getPage(pageNum).then(function (page) {
var scale = 1.5;
var viewport = page.getViewport(scale);
@@ -26,4 +35,11 @@ PDFJS.getDocument('helloworld.pdf').then(function (pdf) {
};
page.render(renderContext);
});
});
}
function goNext() {
if (pdfDoc && pageNum < pdfDoc.numPages) {
++pageNum;
renderPage(pageNum);
}
}
+2 -2
View File
@@ -74,12 +74,12 @@ interface PDFDocumentProxy {
/**
* Total number of pages the PDF contains.
**/
numPages(): number;
numPages: number;
/**
* A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what]
**/
fingerprint(): string;
fingerprint: string;
/**
* True if embedded document fonts are in use. Will be set during rendering of the pages.