From: Yury Delendik Date: Sat, 14 Apr 2012 20:56:57 +0000 (-0700) Subject: Merge branch 'api' of git://github.com/mozilla/pdf.js.git into api X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4953e0fecc8e402703e2b75aa8403d00a23b47fa;p=pdf.js.git Merge branch 'api' of git://github.com/mozilla/pdf.js.git into api --- 4953e0fecc8e402703e2b75aa8403d00a23b47fa diff --cc src/api.js index 479134b,74c58a6..996dd1b --- a/src/api.js +++ b/src/api.js @@@ -101,16 -173,28 +173,31 @@@ var PDFPageProxy = (function PDFPagePro rotate = this.rotate; return new PDFJS.PageViewport(this.view, scale, rotate, 0, 0); }, + /** + * @return {Promise} A promise that is resolved with an {array} of the + * annotation objects. + */ getAnnotations: function() { + if (this.annotationsPromise) + return this.annotationsPromise; + var promise = new PDFJS.Promise(); - var annotations = this.pageInfo.annotations; - promise.resolve(annotations); + this.annotationsPromise = promise; + this.transport.getAnnotations(this.pageInfo.pageIndex); return promise; }, - render: function(renderContext) { + /** + * Begins the process of rendering a page to the desired context. + * @param {object} params A parameter object that supports: + * { + * canvasContext(required): A 2D context of a DOM Canvas object., + * textLayer(optional): An object that has beginLayout, endLayout, and + * appendText functions. + * } + * @return {Promise} A promise that is resolved when the page finishes + * rendering. + */ + render: function(params) { var promise = new Promise(); var stats = this.stats; stats.time('Overall');