Change Status Author

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Change Status Author

Post by asamrith@gmail.com »

Is there anyway to change the Author in the status text e.g. Accepted by jsmith? I would like to know how to take out jsmith or change the teext or just have Accepted. I have attached a pic for more details. Thanks for the help.
Attachments
change status authoor.JPG
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Change Status Author

Post by Will - Tracker Supp »

Hi asamrith@gmail.com,

Thanks for the post - This can be done using a JavaScript:
https://sdkhelp.pdf-xchange.com/vie ... _ExecuteJS

For all annotations:

Code: Select all

//Change Annot Author
var annots = this.getAnnots();

for (var i = 0; i < this.numPages; i++)
{
	for (var j = 0; j < annots.length; j++)
	{
		annots[j].author = ""; //insert author name here
	}
}
For all annots matching a specific author name:

Code: Select all

//Look for annots with specific author and change author name
var annots = this.getAnnots();

for (var i = 0; i < this.numPages; i++)
{
	if (annots[i].author == "") //insert author name here
	{
		for (var j = 0; j < annots.length; j++)
		{
			annots[j].author = ""; //insert new author name here
		}
	}
}
We support most of the features and functions of the Adobe JS API, the documentation for which can be found here:
http://www.adobe.com/content/dam/Adobe/ ... erence.pdf

HTH!
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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Change Status Author

Post by asamrith@gmail.com »

I'm setting the annot status using the JS TransitionToState property and it alwasy default to the current login username even if I change the annot author. Below is my JS code and pic attached of the result. Any other ideas or options please?

Code: Select all

this.syncAnnotScan();
var annots = this.getAnnots();
var guid = 'ef99a0cf-a1e0-45e7-835b0b094d536528';
//console.show();
for (var i = 0; i < annots.length; i++)
{
 if( annots[i].name === guid) 
{
 annots[i].transitionToState("Review","Accepted");
 annots[i].author='saberg';
}
} 
Attachments
change status authoor.JPG
change status authoor.JPG (27.06 KiB) Viewed 2519 times
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK
Contact:

Re: Change Status Author

Post by Will - Tracker Supp »

Hi asamrith,

Firstly, you had single quotations instead of double quotations for two string variables:

Code: Select all

var guid = '05c519e0-141f-46da-98c5307511b32eac';

Code: Select all

annots[i].author='saberg';
Secondly, you had the identity operator instead of the '==' comparison operator:

Code: Select all

 if( annots[i].name === guid)
Also, please be aware that each annotation has a unique name, so that will only work for a single annotation.

Please use this instead:

Code: Select all

this.syncAnnotScan();

var annots = this.getAnnots();
var guid = "ef99a0cf-a1e0-45e7-835b0b094d536528";
//console.show();

for (var i = 0; i < annots.length; i++)
{
 	if( annots[i].name == guid)
	{
		annots[i].transitionToState("Review","Accepted");
		annots[i].author="saberg";
	}
} 

I would recommend that you do not change the author based on the annotation name unless you are only looking to change a single anntoation.

As for the review status name, this is independent of the author name. If you haven't already, you'll need to set a name under Edit --> Preferences --> Identity.

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Change Status Author

Post by asamrith@gmail.com »

Sorry, my issue is still not resolve in changing the status author name when setting a status to an annot. I've tested and followed your suggested code below but still the status always pick the current login user or or current user login name from the Identity. Any other suggestions or changing the status author is not possible? Thanks

Code: Select all

var annots = this.getAnnots();

for (var i = 0; i < this.numPages; i++)
{
   if (annots[i].author == "samrch") //insert author name here
   {
      for (var j = 0; j < annots.length; j++)
      {
         annots[j].author = "saberg"; //insert new author name here
      }
   }
}

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

Re: Change Status Author

Post by Will - Tracker Supp »

Hi asamrith,

Please see the last sentence in my previous post:
As for the review status name, this is independent of the author name. If you haven't already, you'll need to set a name under Edit --> Preferences --> Identity.
Once you've set that, newly set statuses should be made with the new author name.

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
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Change Status Author

Post by asamrith@gmail.com »

Manually having users go through the editor setting...Edit->Preferences->Identity->Name will not work for us. The PDF Exchange Editor SDK is being used as a Peer Review multiple users environment and I need to be able to programmatically set or change the status author name. If this is not possible programmatically, please let me know so I can try to think of another solution or workaround. Thanks
>>As for the review status name, this is independent of the author name. If you haven't already, you'll need to set a name under Edit --> Preferences --> Identity.
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Change Status Author

Post by Ivan - Tracker Software »

Instead of manually change field Name in Edit -> Preferences -> Identity you can set programmatically via that simple JS code:

Code: Select all

identity.name = "abc";
HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
asamrith@gmail.com
User
Posts: 91
Joined: Fri Sep 16, 2016 12:03 am

Re: Change Status Author

Post by asamrith@gmail.com »

I found an acceptable workaround...thanks for the help :)
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Change Status Author

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply