[api-minor] Add support for relative URLs, in both annotations and the outline, by adding a docBaseUrl
parameter to PDFJS.getDocument
(bug 766086)
Note that in `FIREFOX/MOZCENTRAL/CHROME` builds of the standard viewer the `docBaseUrl` parameter will be set by default, since in that case it makes sense to use the current URL as a base. For the `GENERIC` viewer, or the API itself, it doesn't make sense to try and set the `docBaseUrl` by default. However, custom deployments/implementations may still find the parameter useful.
This commit is contained in:
parent
71a781ee5c
commit
d284cfd5eb
11 changed files with 304 additions and 47 deletions
|
@ -480,6 +480,7 @@ var WorkerMessageHandler = {
|
|||
var WorkerTasks = [];
|
||||
|
||||
var docId = docParams.docId;
|
||||
var docBaseUrl = docParams.docBaseUrl;
|
||||
var workerHandlerName = docParams.docId + '_worker';
|
||||
var handler = new MessageHandler(workerHandlerName, docId, port);
|
||||
|
||||
|
@ -544,7 +545,7 @@ var WorkerMessageHandler = {
|
|||
if (source.data) {
|
||||
try {
|
||||
pdfManager = new LocalPdfManager(docId, source.data, source.password,
|
||||
evaluatorOptions);
|
||||
evaluatorOptions, docBaseUrl);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
} catch (ex) {
|
||||
pdfManagerCapability.reject(ex);
|
||||
|
@ -593,7 +594,7 @@ var WorkerMessageHandler = {
|
|||
length: fullRequest.contentLength,
|
||||
disableAutoFetch: disableAutoFetch,
|
||||
rangeChunkSize: source.rangeChunkSize
|
||||
}, evaluatorOptions);
|
||||
}, evaluatorOptions, docBaseUrl);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
cancelXHRs = null;
|
||||
}).catch(function (reason) {
|
||||
|
@ -610,7 +611,7 @@ var WorkerMessageHandler = {
|
|||
// the data is array, instantiating directly from it
|
||||
try {
|
||||
pdfManager = new LocalPdfManager(docId, pdfFile, source.password,
|
||||
evaluatorOptions);
|
||||
evaluatorOptions, docBaseUrl);
|
||||
pdfManagerCapability.resolve(pdfManager);
|
||||
} catch (ex) {
|
||||
pdfManagerCapability.reject(ex);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue