Change dynamic stamp text after placement

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
lidds
User
Posts: 449
Joined: Sat May 16, 2009 1:55 pm

Change dynamic stamp text after placement

Post by lidds » Fri Feb 28, 2020 11:46 am

I have created a dynamic stamp that has 2 text fields on the stamp and added the below JS to one of the text fields.

Code: Select all

var oDlg = {
    strName: "", initialize: function(dialog) {
        dialog.load({"frmData":this.strLine1});
    },
    commit: function(dialog) {
        var data = dialog.store(); 
        this.strLine1 = data[ "txtLine1"]; 
        this.strLine2 = data[ "txtLine2"]; 
    },
    description: {
        name: "Enter Symbol Data", elements: [ {
            type: "view", elements: [
                { name: "Enter Line1:", type: "static_text", }, 
                { item_id: "txtLine1", type: "edit_text", char_width: 50 },
                { name: "Enter Line2:", type: "static_text", },
                { item_id: "txtLine2", type: "edit_text", char_width: 50 },
                { type: "ok_cancel", },
            ]
        },]
    }
};  

// Dialog Activation 
if(event.source.forReal && (this.selectedAnnots[0].AP == "qC0lj9Fnk5MVjEK7Z2jDr1"))
{
if( "ok" == app.execDialog(oDlg)) { 
    getField("txtLine1").value = oDlg.strLine1; 
    getField("txtLine2").value = oDlg.strLine2; 
}
}
The JS works correctly and when placing the stamp a dialog box appears asking to enter line 1 and line 2 text and adds this to the stamp. Great!!

My question is if there is a way to write some JS that the user can select the already placed dynamic stamp and run the JS to display the same dialog with the text values that were previously entered in the dialog. Then the user could edit the values and click OK on the dialog form and this would replace the text on the text fields on the stamp.

I was thinking something like this on the OK event to change the text, but it does not work

Code: Select all

// Dialog Activation 
if(this.selectedAnnots[0].AP == "qC0lj9Fnk5MVjEK7Z2jDr1")
{
if( "ok" == app.execDialog(oDlg)) { 
    this.selectedAnnots[0].getField("txtLine1").value = oDlg.strLine1; 
    this.selectedAnnots[0].getField("txtLine2").value = oDlg.strLine2; 
}
}
Thanks

Simon

User avatar
Will - Tracker Supp
Site Admin
Posts: 6905
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Change dynamic stamp text after placement

Post by Will - Tracker Supp » Fri Feb 28, 2020 12:01 pm

Hi Simon,

Thanks for the post - This isn't possible with JavaScript because once a dynamic stamp is placed it becomes a static stamp; essentially just an image.

For text-based stamps, you should be able to flatten the stamp and it will then be recognized as text. With that you may be able customize your app to offer this. However, I would suggest that this isn't trivial, even if it's possible.

Thanks,
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com

Post Reply