Hello All,
Have created a "Save" button on my PDF that will allow user to save the file to a specific location on their drive. Although I have it the way I want it there is one need thing. I need the output file to read UTC time instead of the local PC time.
Here is my code:
//DateTime function
function myDateString()
{
return util.printd("dddd mmmm dd yyyy HHMM", new Date());
}
// SaveAs Function
var mySaveDoc = app.trustedFunction(function(doc) {
app.beginPriv();
var myPath ="c:/Documents and Settings/FRAC/" + myDateString() + ".pdf";
// saveAs is the only privileged code that needs to be enclosed
// with beginPriv/endPriv
doc.saveAs(myPath);
app.endPriv();
});
Note: The script above is place in the Adobe Reader folder on the local drive.
The script below script is in attached to the button in the PDF doc itself:
event.target.mySaveDoc(event.target);
When I open the pdf doc and click the “Save” button it saves it to “myPath” above with the correct date/time stamp of the local PC.
i.e. “Saturday December 13 2008 1600”
I need it to save the time as UTC instead of local.
i.e. “Saturday December 13 2008 2100” (Corrected for UTC)
Any help is greatly appreciated
PS: Is there a way to incorporate this js into the document itself? This in order to keep the end user from installing the js into the local reader js floder
//DateTime function
function myDateString() {
// zero bases array of days of the week
var aDays = new Array("Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday");
// zero based array of the months of the year
var aMonths = new Array("January", "February", "March", "April",
"May", "June", "July", "August", "September", "October", "November", "December");
var oNow = new Date(); // get the current date object
// build the date time string using the UTC value
var sUTCDateTime = aDays[oNow.getUTCDay()]; // place the day of the week string
sUTCDateTime = sUTCDateTime + " " + aMonths[oNow.getUTCMonth()]; // add month string
sUTCDateTime = sUTCDateTime + " " + oNow.getUTCDate(); // add day of month
sUTCDateTime = sUTCDateTime + " " + oNow.getUTCFullYear(); // add full year
sUTCDateTime = sUTCDateTime + " " + oNow.getUTCHours(); // add hours
sUTCDateTime = sUTCDateTime + oNow.getUTCMinutes(); // add minutes
return sUTCDateTime; // return formatted string
}
George Kaiser