[api-minor] Let getAnnotations fetch all annotations by default, unless an intent is specified

Currently `getAnnotations` will *only* fetch annotations that are either `viewable` or `printable`. This is "hidden" inside the `core.js` file, meaning that API consumers might be confused as to why they are not recieving *all* the annotations present for a page.

I thus think that the API should, by default, return *all* available annotations unless specifically told otherwise. In e.g. the default viewer, we obviously only want to display annotations that are `viewable`, hence this patch adds an `intent` parameter to `getAnnotations` that makes it possible to decide if only `viewable` or `printable` annotations should be fetched.
This commit is contained in:
Jonas Jenwald 2015-11-22 13:56:52 +01:00
parent aa75c4fe4e
commit b05652ca97
6 changed files with 55 additions and 17 deletions

View file

@ -399,7 +399,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
handler.on('GetDestination',
function wphSetupGetDestination(data) {
return pdfManager.ensureCatalog('getDestination', [ data.id ]);
return pdfManager.ensureCatalog('getDestination', [data.id]);
}
);
@ -447,7 +447,7 @@ var WorkerMessageHandler = PDFJS.WorkerMessageHandler = {
handler.on('GetAnnotations', function wphSetupGetAnnotations(data) {
return pdfManager.getPage(data.pageIndex).then(function(page) {
return pdfManager.ensure(page, 'getAnnotationsData', []);
return pdfManager.ensure(page, 'getAnnotationsData', [data.intent]);
});
});