Skip to content

Commit ca99476

Browse files
committed
JS - Implement securityHandler in the scripting API
1 parent 2322bda commit ca99476

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/scripting_api/doc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,8 @@ class Doc extends PDFObject {
526526
return this._securityHandler;
527527
}
528528

529-
set securityHandler(securityHandler) {
530-
this._securityHandler = securityHandler;
529+
set securityHandler(_) {
530+
throw new Error("doc.securityHandler is read-only");
531531
}
532532

533533
get selectedAnnots() {

src/scripting_api/field.js

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class Field extends PDFObject {
5858
this.richText = data.richText;
5959
this.richValue = data.richValue;
6060
this.rotation = data.rotation;
61+
this.securityHandler = data.securityHandler;
6162
this.style = data.style;
6263
this.submitName = data.submitName;
6364
this.textFont = data.textFont;

web/app.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,7 @@ const PDFViewerApplication = {
852852
this._downloadUrl = "";
853853
this.documentInfo = null;
854854
this.metadata = null;
855-
this._securityHandler = null;
855+
this.securityHandler = null;
856856
this._contentDispositionFilename = null;
857857
this._contentLength = null;
858858
this._saveInProgress = false;
@@ -1451,7 +1451,7 @@ const PDFViewerApplication = {
14511451
authors: this.metadata?.get("dc:creator"),
14521452
numPages: this.pagesCount,
14531453
URL: this.url,
1454-
securityHandler: this._securityHandler,
1454+
securityHandler: this.securityHandler,
14551455
};
14561456
},
14571457

@@ -1533,7 +1533,7 @@ const PDFViewerApplication = {
15331533
}
15341534
this.documentInfo = info;
15351535
this.metadata = metadata;
1536-
this._securityHandler = securityHandler;
1536+
this.securityHandler = securityHandler;
15371537
this._contentDispositionFilename ??= contentDispositionFilename;
15381538
this._contentLength ??= contentLength; // See `getDownloadInfo`-call above.
15391539

web/generic_scripting.js

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ async function docPropertiesLookup(pdfDocument) {
3131
const { length } = await pdfDocument.getDownloadInfo();
3232
contentLength = length;
3333
}
34-
console.log(`HERE GEER_SRC`);
3534

3635
return {
3736
...info,

0 commit comments

Comments
 (0)