• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Place a dynamic stamp with additional JavaScript to lock the file

New Here ,
Sep 11, 2024 Sep 11, 2024

Copy link to clipboard

Copied

With the help of the community here, I've managed to create a dynamic stamp with several fields.

Now I'm facing the next problem:

The idea is to place the stamp in a PDF (e.g. on invoices), fill in all the required information and then, after placing the stamp, the PDF should be locked for editing.

Best case would be, to integrate the locking process directly in the JavaScript of the dynamic stamp so all the actions are stored at the same place.

Does anyone have experience with this or even did this already and can provide me with the relevant code?

I know, that it's difficult to trigger an action for the parent PDF through JavaScript in the child PDF, but any help or workaround is highly appreciated.

For the sake of completeness, here's the script I use for the dynamic stamp:

 

if (event.source.forReal && (event.source.stampName == "#KwMXGwf5fxz7y1M4wPwL3A"))

 

    var JSADMDlg1 = {

 

        result: "cancel",

        DoDialog: function() {

            return app.execDialog(this);

        },

        job: "txt1",

        specsection: "txt2",

        shopdwg: "txt3",

        submittaldate: "txt4",

        reviewedby: "txt5",

        initialize: function(dialog) {

            var dlgInit = {

                "txt1": this.job,

                "txt2": this.specsection,

                "txt3": this.shopdwg,

                "txt4": this.submittaldate,

                "txt5": this.reviewedby,

            };

            dialog.load(dlgInit);

        },

        commit: function(dialog) {

            var oRslt = dialog.store();

            this.job = oRslt["txt1"];

            this.specsection = oRslt["txt2"];

            this.shopdwg = oRslt["txt3"];

            this.submittaldate = oRslt["txt4"];

            this.reviewedby = oRslt["txt5"];

        },

        description: {

            name: "JSADM Dialog",

            elements: [{

                type: "view",

                width: 254,

                height: 351,

                elements: [{

                        type: "view",

                        width: 236,

                        height: 354,

                        char_height: 10,

                        elements: [{

                                type: "static_text",

                                item_id: "sta1",

                                name: "Notizen/Fliesstext",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt1",

                                variable_Name: "job",

                                width: 200,

                                height: 80,

                                char_width: 8,

                                multiline: true,

                            },

                            {

                                type: "static_text",

                                item_id: "sta2",

                                name: "Betrag",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt2",

                                variable_Name: "specsection",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta3",

                                name: "BKP",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt3",

                                variable_Name: "shopdwg",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta4",

                                name: "Zahlungsart",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt4",

                                variable_Name: "submittaldate",

                                char_width: 8,

                            },

                            {

                                type: "static_text",

                                item_id: "sta5",

                                name: "Datum",

                            },

                            {

                                type: "edit_text",

                                item_id: "txt5",

                                variable_Name: "reviewedby",

                                char_width: 8,

                            },

                        ]

                    },

                    {

                        type: "ok_cancel",

                        width: 64,

                        height: 23,

                    },

                ]

            }, ]

        }

    };

 

JSADMDlg1.job = "";

JSADMDlg1.specsection = "";

JSADMDlg1.shopdwg = "";

JSADMDlg1.submittaldate = "";

JSADMDlg1.reviewedby = "";

if ("ok" == JSADMDlg1.DoDialog()) {

 

    this.getField("txt1").value = JSADMDlg1.job;

    this.getField("txt2").value = JSADMDlg1.specsection;

    this.getField("txt3").value = JSADMDlg1.shopdwg;

    this.getField("txt4").value = JSADMDlg1.submittaldate;

    this.getField("txt5").value = JSADMDlg1.reviewedby;

}

TOPICS
JavaScript

Views

84

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

LATEST

During the stamping process the document being stamped is called as event.source.source.  You can apply a security policy with a script to the document, but it has to be from a privileged context, in this case you would call a trusted function from a folder level script.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines