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

Display widget signature

- but don't validate them for now;
  - Firefox will display a bar to warn that the signature validation is not supported (see https://bugzilla.mozilla.org/show_bug.cgi?id=854315)
  - almost all (all ?) pdf readers display signatures;
  - validation is done in edge but for now it's behind a pref.
This commit is contained in:
Calixte Denizet 2021-04-10 16:53:17 +02:00
parent 6ddc297170
commit 5875ebb1ca
10 changed files with 58 additions and 19 deletions

View file

@ -828,7 +828,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);
@ -854,9 +859,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;
@ -894,6 +901,7 @@ class PDFDocument {
IsAcroFormPresent: this.formInfo.hasAcroForm,
IsXFAPresent: this.formInfo.hasXfa,
IsCollectionPresent: !!this.catalog.collection,
IsSignaturesPresent: this.formInfo.hasSignatures,
};
let infoDict;