﻿/**
* @@@BUILDINFO@@@ exportToPDF.jsx !Version! Tue Jun 17 2014 09:34:15 GMT+0400
*/
#target indesign
try
{
	app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
	if ( app.activeDocument instanceof Object ) 
	{
		try
		{
			var path;
			try
			{
				if ( arguments instanceof Array )
				{
					path = arguments[0];
				}
				else
				{
					path = app.activeDocument.fullName.fsName.replace( ".indd", ".pdf" );
				}
			}
			catch ( e )
			{
				path = app.activeDocument.fullName.fsName.replace( ".indd", ".pdf" );
			}
			app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
			app.activeDocument.exportFile( ExportFormat.pdfType, File( path ) );
			alert( "Operation complete: " + path, "Export to PDF", false );
		}
		catch ( e )
		{
			alert( e.description , "Export to PDF", true );
		}
	}
}
catch ( e )
{
	exit(0);
}

