mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Save form data in XFA datasets when pdf is a mix of acroforms and xfa (#12344)
* Move display/xml_parser.js in shared to use it in worker * Save form data in XFA datasets when pdf is a mix of acroforms and xfa Co-authored-by: Brendan Dahl <brendan.dahl@gmail.com>
This commit is contained in:
parent
622e2fbd3a
commit
68b99c59ee
11 changed files with 416 additions and 19 deletions
|
@ -17,6 +17,7 @@ import {
|
|||
bytesToString,
|
||||
createPromiseCapability,
|
||||
createValidAbsoluteUrl,
|
||||
encodeToXmlString,
|
||||
escapeString,
|
||||
getModificationDate,
|
||||
isArrayBuffer,
|
||||
|
@ -24,6 +25,7 @@ import {
|
|||
isNum,
|
||||
isSameOrigin,
|
||||
isString,
|
||||
parseXFAPath,
|
||||
removeNullCharacters,
|
||||
string32,
|
||||
stringToBytes,
|
||||
|
@ -331,4 +333,32 @@ describe("util", function () {
|
|||
expect(getModificationDate(date)).toEqual("31410610020653");
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseXFAPath", function () {
|
||||
it("should get a correctly parsed path", function () {
|
||||
const path = "foo.bar[12].oof[3].rab.FOO[123].BAR[456]";
|
||||
expect(parseXFAPath(path)).toEqual([
|
||||
{ name: "foo", pos: 0 },
|
||||
{ name: "bar", pos: 12 },
|
||||
{ name: "oof", pos: 3 },
|
||||
{ name: "rab", pos: 0 },
|
||||
{ name: "FOO", pos: 123 },
|
||||
{ name: "BAR", pos: 456 },
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("encodeToXmlString", function () {
|
||||
it("should get a correctly encoded string with some entities", function () {
|
||||
const str = "\"\u0397ell😂' & <W😂rld>";
|
||||
expect(encodeToXmlString(str)).toEqual(
|
||||
""Ηell😂' & <W😂rld>"
|
||||
);
|
||||
});
|
||||
|
||||
it("should get a correctly encoded basic ascii string", function () {
|
||||
const str = "hello world";
|
||||
expect(encodeToXmlString(str)).toEqual(str);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue