mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Include the document-id in the SVG-filter names (PR 16062 follow-up)
In the general PDF.js library multiple PDF documents may be opened on the same web-page, which is why we many years ago started using document-specific identifiers to prevent issues with global data such e.g. with fonts. Hence we need to treat the identifiers generated by the `FilterFactory` in the same way, since the SVG-filters for two separate PDF documents may otherwise get identical ids.
This commit is contained in:
parent
a0ef5a4ae1
commit
92296fa6a1
2 changed files with 7 additions and 4 deletions
|
@ -269,6 +269,7 @@ function getDocument(src) {
|
|||
);
|
||||
}
|
||||
const task = new PDFDocumentLoadingTask();
|
||||
const { docId } = task;
|
||||
|
||||
const url = src.url ? getUrlProp(src.url) : null;
|
||||
const data = src.data ? getDataProp(src.data) : null;
|
||||
|
@ -339,7 +340,7 @@ function getDocument(src) {
|
|||
const canvasFactory =
|
||||
src.canvasFactory || new DefaultCanvasFactory({ ownerDocument });
|
||||
const filterFactory =
|
||||
src.filterFactory || new FilterFactory({ ownerDocument });
|
||||
src.filterFactory || new FilterFactory({ docId, ownerDocument });
|
||||
|
||||
// Parameters only intended for development/testing purposes.
|
||||
const styleElement =
|
||||
|
@ -378,7 +379,6 @@ function getDocument(src) {
|
|||
: new PDFWorker(workerParams);
|
||||
task._worker = worker;
|
||||
}
|
||||
const docId = task.docId;
|
||||
|
||||
const fetchDocParams = {
|
||||
docId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue