Make stamp readonly the moment it is placed

PDF-XChange Editor SDK for Developers

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

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
ng80092a
User
Posts: 21
Joined: Thu May 13, 2021 11:50 am

Make stamp readonly the moment it is placed

Post by ng80092a »

Hi,

Is it possible to make a stamp readonly as soon as it is placed?

I know how to do it with a function later, but it would be more convenient to make it read only as soon as its placed on the dynamic stamp javascript.

Kind regards,
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17765
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Make stamp readonly the moment it is placed

Post by Tracker Supp-Stefan »

Hello ng80092a,

This is the default behaviour of "dynamic" content in dynamic stamps - it becomes static the moment the stamp is placed.
Or do you want to make the whole stamp object read only?
This will have to be done after the stamp placement event.

Kind regards,
Stefan
ng80092a
User
Posts: 21
Joined: Thu May 13, 2021 11:50 am

Re: Make stamp readonly the moment it is placed

Post by ng80092a »

Hi Stefan,

Thanks for the reply, Yes. I want to change the stamp properties after it is placed, by performing a secondary action indeed.
I was able to get close, but not enough, by running a function that would determine the last created stamp on the document.

This of course, will perform the property change on the previous created stamp and not the one that I'm actually inserting.

The code inside the dynamic stamp:

Code: Select all

returnlaststamp(event.source.source);
The code on the roaming .js file

Code: Select all

function returnlaststamp(thedoc)
{
var oStampCount = {};
var previousaAnnots = "";
var d0 = new Date(1998,01,01,0,0,0,0);
for(var p=0; p<thedoc.numPages; p++) {


var aAnnots = thedoc.getAnnots(p)

if (aAnnots != null )
  {
    for(i=0;i<aAnnots.length;i++)
  {
    if(aAnnots[i].type == "Stamp")
    {
        var cStampName = aAnnots[i].AP;
       

      var d1 = aAnnots[i].creationDate;

                 if (d1 > d0)
            {

          d0 = d1;
        laststampname = aAnnots[i].name;
        laststamppage = aAnnots[i].page;

            }
          

    }
}
}
}
return [laststampname, laststamppage];
}
What I would need is to run the function, but immediately after the stamp is created so it is considered in the loop trough the document.
Would that be possible somehow?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Make stamp readonly the moment it is placed

Post by Sasha - Tracker Dev Team »

Hello ng80092a,

Are you using the Editor SDK or the End-User Editor's JS?

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
ng80092a
User
Posts: 21
Joined: Thu May 13, 2021 11:50 am

Re: Make stamp readonly the moment it is placed

Post by ng80092a »

The End user, but would SDK release be able to do this?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Make stamp readonly the moment it is placed

Post by Sasha - Tracker Dev Team »

Hello ng80092a,

The Editor SDK is able to do that.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply