mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #2043 from Kroisse/pdf.js
pdf: correct the type of some attributes
This commit is contained in:
+18
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user