Hi
I created a pdf with a save button that executes a javascript with the saveas function.
Problem is that it only seems to work on my PC and no other as the script does not appear to run.
Kind regards
Andy
I added it to a button as run a javascript on mouse down
added the code to it which I have popped below:
/* Save files with a timestamp filename */
/* this script does not overwrite existing files - unique names are created */
/* EverMap LLC, 2009 */
function DoesFileExists(pathname)
{
var result = false;
try
{
var otherDoc = app.openDoc(pathname);
if (otherDoc != null)
{
result = true;
otherDoc.closeDoc();
}
}
catch(e)
{
result = false;
}
return result;
}
// create a unique filename for output file
function GetUniqueOutputFileName(pathName)
{
var i = 1;
var baseName = pathName.slice(0, pathName.length - 4);
var testName = pathName;
while (DoesFileExists(testName) == true)
{
testName = baseName + " " + i + ".pdf";
i++;
}
return testName;
}
var i = this.path.search(/[^:/]+\.pdf$/);
var fname = this.path.slice(i, this.path.length - 4);
// replace /c/data/ with a desired folder path where to store extracted files
var folder = "/c/Click2Sign/ForConversion/";
// now add time stamp data to the filename
var t = new Date();
fname += " - " + t.toLocaleString();
var outputname = fname.replace(/[,\\/\?*<>]/g," ");
outputname = outputname.replace(/[:]/g,"-");
var outputpath = folder + outputname + ".pdf";
this.saveAs(GetUniqueOutputFileName(outputpath));
Read this tutorial, carefully: http://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript
North America
Europe, Middle East and Africa
Asia Pacific