mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Move the Metadata parsing to the worker-thread
The only reason, as far as I can tell, for parsing the Metadata on the main-thread is how it was originally implemented. When Metadata support was first implemented, it utilized the [`DOMParser`](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser) which isn't available in workers. Today, with the custom XML-parser being used, that's no longer an issue and it seems reasonable to move the Metadata parsing to the worker-thread[1], since that's where all parsing should happen (for performance reasons). Based on these changes, we'll be able to reduce the now unnecessary duplication of the XML-parser (and related code) in both of the *built* `pdf.js`/`pdf.worker.js` files. Finally, this patch changes the `_repair` method to use "Array + join" rather than string concatenation. --- [1] This needed the previous patch, to enable sending of `Map`s between threads with workers disabled.
This commit is contained in:
parent
73bf45e64b
commit
cc3a6563ee
6 changed files with 177 additions and 142 deletions
|
@ -1755,11 +1755,8 @@ const PDFViewerApplication = {
|
|||
`${this.pdfViewer.enableWebGL ? " [WebGL]" : ""})`
|
||||
);
|
||||
|
||||
let pdfTitle;
|
||||
const infoTitle = info?.Title;
|
||||
if (infoTitle) {
|
||||
pdfTitle = infoTitle;
|
||||
}
|
||||
let pdfTitle = info?.Title;
|
||||
|
||||
const metadataTitle = metadata?.get("dc:title");
|
||||
if (metadataTitle) {
|
||||
// Ghostscript can produce invalid 'dc:title' Metadata entries:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue