1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Merge pull request #12838 from calixteman/authors

[api-minor] Change the "dc:creator" Metadata field to an Array
This commit is contained in:
calixteman 2021-01-12 02:44:58 -08:00 committed by GitHub
commit 1de1ae0be6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 97 additions and 33 deletions

View file

@ -451,4 +451,29 @@ describe("Interaction", () => {
);
});
});
describe("in js-authors.pdf", () => {
let pages;
beforeAll(async () => {
pages = await loadAndWait("js-authors.pdf", "#\\32 5R");
});
afterAll(async () => {
await closePages(pages);
});
it("must print authors in a text field", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const text = await actAndWaitForInput(page, "#\\32 5R", async () => {
await page.click("[data-annotation-id='26R']");
});
expect(text)
.withContext(`In ${browserName}`)
.toEqual("author1::author2::author3::author4::author5");
})
);
});
});
});

View file

@ -325,6 +325,7 @@
!tensor-allflags-withfunction.pdf
!issue10084_reduced.pdf
!issue4246.pdf
!js-authors.pdf
!issue4461.pdf
!issue4573.pdf
!issue4722.pdf

BIN
test/pdfs/js-authors.pdf Normal file

Binary file not shown.

View file

@ -96,7 +96,7 @@ describe("metadata", function () {
expect(metadata.get("dc:qux")).toEqual(null);
expect(metadata.getAll()).toEqual({
"dc:creator": "ODIS",
"dc:creator": ["ODIS"],
"dc:title": "L'Odissee thématique logo Odisséé - décembre 2008.pub",
"xap:creatortool": "PDFCreator Version 0.9.6",
});
@ -168,7 +168,7 @@ describe("metadata", function () {
expect(metadata.get("dc:qux")).toEqual(null);
expect(metadata.getAll()).toEqual({
"dc:creator": "",
"dc:creator": [""],
"dc:description": "",
"dc:format": "application/pdf",
"dc:subject": "",

View file

@ -47,8 +47,9 @@ describe("XML", function () {
<g a="121110"/>
</b>
</a>`;
const root = new SimpleXMLParser(true).parseFromString(xml)
.documentElement;
const root = new SimpleXMLParser({ hasAttributes: true }).parseFromString(
xml
).documentElement;
function getAttr(path) {
return root.searchNode(parseXFAPath(path), 0).attributes[0].value;
}
@ -96,8 +97,9 @@ describe("XML", function () {
<g a="121110"/>
</b>
</a>`;
const root = new SimpleXMLParser(true).parseFromString(xml)
.documentElement;
const root = new SimpleXMLParser({ hasAttributes: true }).parseFromString(
xml
).documentElement;
const buffer = [];
root.dump(buffer);