Hello,
Is there a way possible to set annotations properties if a condition on their modification date is respected ?
For exemple, I want to set the opacity property for annotations whose modification date is October 8, 2013.
This Javascript code does not work :
var annots = this.getAnnots({ nPage:0 });
for (var i = 0; i < annots.length; i++)
if (annots.modDate == "08/10/2013"
annots.opacity = 0.5;
I tried different date formats, but without success.
Can you help me, please ?
Thanks a lot.
Best regards.
Set annotations properties by their modification date
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 9
- Joined: Tue Jul 30, 2013 4:41 pm
-
- Site Admin
- Posts: 3586
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Set annotations properties by their modification date
modDate property of annotation returns Date object (http://www.w3schools.com/jsref/jsref_obj_date.asp), not string.
One of the possible ways to solve your task is:
HTH
One of the possible ways to solve your task is:
Code: Select all
var annots = this.getAnnots({ nPage:0 });
for (var i = 0; i < annots.length; i++)
{
if (util.printd("mm/dd/yyyy", annots[i].modDate) == "08/10/2013")
annots[i].opacity = 0.5;
}
PDF-XChange Co Ltd. (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.
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.
-
- User
- Posts: 9
- Joined: Tue Jul 30, 2013 4:41 pm
Re: Set annotations properties by their modification date
Hello Ivan,
You're right, it's not a string !
Your code works perfectly !
Thanks a lot,
Best regards
You're right, it's not a string !
Your code works perfectly !
Thanks a lot,
Best regards
-
- Site Admin
- Posts: 7371
- Joined: Wed Mar 25, 2009 10:37 pm
Re: Set annotations properties by their modification date

Best regards
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com