// save front-most document as a PDF





//$.bp();	//	Uncomment this line to cause the script to be run in the JavaScript debugger window.





numDocuments = documents.length;





for ( i = 0 ; i < numDocuments; i++)


{


	aDocument = documents[i];


	theDocumentName = aDocument.name;


	


	pdfSaveOptions = new PDFSaveOptions();


	pdfSaveOptions.preserveEditability = true;





	docPath = aDocument.path;


	docPathStr = docPath.toString();





	if (docPathStr.length > 1)


	{


		documentPath = aDocument.path + "/" + aDocument.name;		


	}


	else


	{


		// This is a brand new file and doesn't have a path yet,


		// so put it in the illustrator application folder.


		documentPath = path + "/" + aDocument.name;


	}





	theFile = new File(documentPath);


	aDocument.saveAs(theFile, pdfSaveOptions);


}


