mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
Add support for "GoToE" actions with destinations (issue 17056)
This shouldn't be very common in practice, since "GoToE" actions themselves seem quite uncommon; see PR 15537.
This commit is contained in:
parent
da4fdc76a3
commit
bf9c33e60f
7 changed files with 62 additions and 19 deletions
|
@ -67,7 +67,7 @@ class DownloadManager {
|
|||
/**
|
||||
* @returns {boolean} Indicating if the data was opened.
|
||||
*/
|
||||
openOrDownloadData(element, data, filename) {
|
||||
openOrDownloadData(element, data, filename, dest = null) {
|
||||
const isPdfData = isPdfFile(filename);
|
||||
const contentType = isPdfData ? "application/pdf" : "";
|
||||
|
||||
|
@ -93,6 +93,9 @@ class DownloadManager {
|
|||
"?file=" +
|
||||
encodeURIComponent(blobUrl + "#" + filename);
|
||||
}
|
||||
if (dest) {
|
||||
viewerUrl += `#${escape(dest)}`;
|
||||
}
|
||||
|
||||
try {
|
||||
window.open(viewerUrl);
|
||||
|
|
|
@ -132,7 +132,7 @@ class DownloadManager {
|
|||
/**
|
||||
* @returns {boolean} Indicating if the data was opened.
|
||||
*/
|
||||
openOrDownloadData(element, data, filename) {
|
||||
openOrDownloadData(element, data, filename, dest = null) {
|
||||
const isPdfData = isPdfFile(filename);
|
||||
const contentType = isPdfData ? "application/pdf" : "";
|
||||
|
||||
|
@ -143,7 +143,10 @@ class DownloadManager {
|
|||
this.#openBlobUrls.set(element, blobUrl);
|
||||
}
|
||||
// Let Firefox's content handler catch the URL and display the PDF.
|
||||
const viewerUrl = blobUrl + "#filename=" + encodeURIComponent(filename);
|
||||
let viewerUrl = blobUrl + "?filename=" + encodeURIComponent(filename);
|
||||
if (dest) {
|
||||
viewerUrl += `#${escape(dest)}`;
|
||||
}
|
||||
|
||||
try {
|
||||
window.open(viewerUrl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue