1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Merge pull request #13214 from calixteman/signatures

Display widget signature
This commit is contained in:
Tim van der Meij 2021-04-10 19:35:16 +02:00 committed by GitHub
commit d9d626a5e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 58 additions and 19 deletions

View file

@ -848,7 +848,12 @@ class PDFDocument {
}
get formInfo() {
const formInfo = { hasFields: false, hasAcroForm: false, hasXfa: false };
const formInfo = {
hasFields: false,
hasAcroForm: false,
hasXfa: false,
hasSignatures: false,
};
const acroForm = this.catalog.acroForm;
if (!acroForm) {
return shadow(this, "formInfo", formInfo);
@ -874,9 +879,11 @@ class PDFDocument {
// the first bit of the `SigFlags` integer (see Table 219 in the
// specification).
const sigFlags = acroForm.get("SigFlags");
const hasSignatures = !!(sigFlags & 0x1);
const hasOnlyDocumentSignatures =
!!(sigFlags & 0x1) && this._hasOnlyDocumentSignatures(fields);
hasSignatures && this._hasOnlyDocumentSignatures(fields);
formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
formInfo.hasSignatures = hasSignatures;
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
@ -914,6 +921,7 @@ class PDFDocument {
IsAcroFormPresent: this.formInfo.hasAcroForm,
IsXFAPresent: this.formInfo.hasXfa,
IsCollectionPresent: !!this.catalog.collection,
IsSignaturesPresent: this.formInfo.hasSignatures,
};
let infoDict;