1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-21 23:58:07 +02:00

XFA - Add a layer to display XFA forms (#13069)

- add an option to enable XFA rendering if any;
  - for now, let the canvas layer: it could be useful to implement XFAF forms (embedded pdf in xml stream for the background and xfa form for the foreground);
  - ui elements in template DOM are pretty close to their html counterpart so we generate a fake html DOM from template one:
    - it makes easier to translate template properties to html ones;
    - it makes faster the creation of the html element in the main thread.
This commit is contained in:
calixteman 2021-03-19 10:11:40 +01:00 committed by GitHub
parent a164941351
commit 24e598a895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 760 additions and 27 deletions

View file

@ -81,9 +81,9 @@ describe("XFAParser", function () {
};
const mediumAttributes = {
id: "",
long: { value: 0, unit: "" },
long: { value: 0, unit: "pt" },
orientation: "portrait",
short: { value: 0, unit: "" },
short: { value: 0, unit: "pt" },
stock: "",
trayIn: "auto",
trayOut: "auto",
@ -116,17 +116,17 @@ describe("XFAParser", function () {
allowMacro: 0,
anchorType: "topLeft",
colSpan: 1,
columnWidths: [{ value: 0, unit: "" }],
h: { value: 0, unit: "" },
columnWidths: [{ value: 0, unit: "pt" }],
h: { value: 0, unit: "pt" },
hAlign: "left",
id: "",
layout: "position",
locale: "",
maxH: { value: 0, unit: "" },
maxW: { value: 0, unit: "" },
maxH: { value: 0, unit: "pt" },
maxW: { value: 0, unit: "pt" },
mergeMode: "consumeData",
minH: { value: 0, unit: "" },
minW: { value: 0, unit: "" },
minH: { value: 0, unit: "pt" },
minW: { value: 0, unit: "pt" },
name: "",
presence: "visible",
relevant: [],
@ -134,14 +134,14 @@ describe("XFAParser", function () {
scope: "name",
use: "",
usehref: "",
w: { value: 0, unit: "" },
x: { value: 0, unit: "" },
y: { value: 0, unit: "" },
w: { value: 0, unit: "pt" },
x: { value: 0, unit: "pt" },
y: { value: 0, unit: "pt" },
proto: {
area: {
...attributes,
colSpan: 1,
x: { value: 0, unit: "" },
x: { value: 0, unit: "pt" },
y: { value: -3.14, unit: "in" },
relevant: [
{ excluded: true, viewname: "foo" },
@ -162,7 +162,7 @@ describe("XFAParser", function () {
{
...mediumAttributes,
imagingBBox: {
x: { value: 1, unit: "" },
x: { value: 1, unit: "pt" },
y: { value: 2, unit: "in" },
width: { value: 3.4, unit: "cm" },
height: { value: 5.67, unit: "px" },
@ -171,10 +171,10 @@ describe("XFAParser", function () {
{
...mediumAttributes,
imagingBBox: {
x: { value: -1, unit: "" },
y: { value: -1, unit: "" },
width: { value: -1, unit: "" },
height: { value: -1, unit: "" },
x: { value: -1, unit: "pt" },
y: { value: -1, unit: "pt" },
width: { value: -1, unit: "pt" },
height: { value: -1, unit: "pt" },
},
},
],