mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[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
|
@ -64,11 +64,12 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
|||
/**
|
||||
* @param {XRef} xref
|
||||
* @param {Object} ref
|
||||
* @param {PDFManager} pdfManager
|
||||
* @param {string} uniquePrefix
|
||||
* @param {Object} idCounters
|
||||
* @returns {Annotation}
|
||||
*/
|
||||
create: function AnnotationFactory_create(xref, ref,
|
||||
create: function AnnotationFactory_create(xref, ref, pdfManager,
|
||||
uniquePrefix, idCounters) {
|
||||
var dict = xref.fetchIfRef(ref);
|
||||
if (!isDict(dict)) {
|
||||
|
@ -88,6 +89,7 @@ AnnotationFactory.prototype = /** @lends AnnotationFactory.prototype */ {
|
|||
ref: isRef(ref) ? ref : null,
|
||||
subtype: subtype,
|
||||
id: id,
|
||||
pdfManager: pdfManager,
|
||||
};
|
||||
|
||||
switch (subtype) {
|
||||
|
@ -846,6 +848,7 @@ var LinkAnnotation = (function LinkAnnotationClosure() {
|
|||
Catalog.parseDestDictionary({
|
||||
destDict: params.dict,
|
||||
resultObj: data,
|
||||
docBaseUrl: params.pdfManager.docBaseUrl,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue