Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#10344 fix #10345

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions src/core/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,16 +545,15 @@ var PDFDocument = (function PDFDocumentClosure() {
}
if (isDict(infoDict)) {
// Only fill the document info with valid entries from the spec.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This patch is very clearly breaking the assumption listed above, which exists to prevent errors since not all data structures (one example is Dict) can be sent from the worker to the main thread.

Assuming first of all that this is even desired functionality, the patch unfortunately cannot be accepted in its current form (furthermore there's also the issue of no tests being include here).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, then what is the intended functionality? Info dict is clearly in the specs since every PDF accepts custom info dict entries. I do not see any discussions among the issues about this matter.

for (let key in DocumentInfoValidators) {
if (infoDict.has(key)) {
const value = infoDict.get(key);
// Make sure the value conforms to the spec.
if (DocumentInfoValidators[key](value)) {
docInfo[key] = (typeof value !== 'string' ?
value : stringToPDFString(value));
} else {
info('Bad value in document info for "' + key + '"');
}
for (let key of infoDict.getKeys()) {
const value = infoDict.get(key);
// Make sure the value conforms to the spec.
if (DocumentInfoValidators[key] &&
!DocumentInfoValidators[key](value)) {
info('Bad value in document info for "' + key + '"');
} else {
docInfo[key] = (typeof value !== 'string' ?
value : stringToPDFString(value));
}
}
}
Expand Down