mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
JS - Add a function in api to get the fields ids in AcroForm::CO
This commit is contained in:
parent
ff2631493e
commit
c30a3a94f0
4 changed files with 48 additions and 0 deletions
|
@ -37,6 +37,7 @@ import {
|
|||
Dict,
|
||||
isDict,
|
||||
isName,
|
||||
isRef,
|
||||
isStream,
|
||||
Ref,
|
||||
} from "./primitives.js";
|
||||
|
@ -1012,6 +1013,21 @@ class PDFDocument {
|
|||
Promise.all(allPromises).then(() => allFields)
|
||||
);
|
||||
}
|
||||
|
||||
get calculationOrderIds() {
|
||||
const acroForm = this.catalog.acroForm;
|
||||
if (!acroForm || !acroForm.has("CO")) {
|
||||
return shadow(this, "calculationOrderIds", null);
|
||||
}
|
||||
|
||||
const calculationOrder = acroForm.get("CO");
|
||||
if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
|
||||
return shadow(this, "calculationOrderIds", null);
|
||||
}
|
||||
|
||||
const ids = calculationOrder.filter(isRef).map(ref => ref.toString());
|
||||
return shadow(this, "calculationOrderIds", ids);
|
||||
}
|
||||
}
|
||||
|
||||
export { Page, PDFDocument };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue