saveFileToPDF(getName());
function getName(){
var doc = app.activeDocument;
var aFile = doc.fullName;
var aName = aFile.name;
aName = aName.substring(0,aName.lastIndexOf('.'));
return aFile.parent+'/'+aName+".pdf";
}
function saveFileToPDF (dest) {
var doc = app.activeDocument;
if ( app.documents.length > 0 ) {
var saveName = new File ( dest );
saveOpts = new PDFSaveOptions();
saveOpts.pDFPreset = "3";
doc.saveAs( saveName, saveOpts );
}
}