StringBuilder = function (initialText) {
    this._array = (typeof (initialText) !== 'undefined' && initialText !== null && initialText !== '') ? [initialText] : [];
    this.append = function (text) {
        this._array[this._array.length] = text;
    }
    this.appendLine = function (text) {
        this._array[this._array.length] = ((typeof (text) === 'undefined') || (text === null) || (text === '')) ? '\r\n' : text + '\r\n';
    }
    this.clear = function (text) {
        this._array = [];
    }
    this.isEmpty = function () {
        return (this._array.length == 0 ? true : false);
    }
    this.toString = function (separator) {
        separator = separator || ''
        var array = this._array;
        if (separator !== '') {
            for (var i = 0; i < array.length; ) {
                if ((typeof (array[i]) === 'undefined') || (array[i] === '') || (array[i] === null)) {
                    array.splice(i, 1);
                }
                else {
                    i++;
                }
            }
        }
        return array.join(separator);
    }
    this.indexOf = function (searchvalue) {
        return this._array.indexOf(searchvalue);
    }
    this.contains = function (text) {
        return this._array.contains(text);
    }
}

public sealed class AcrobatUtil
{
	public string ConvertToExecl(string inputFileName, string outputFileName)
	{
		//判断文件是否存在
		if (!File.Exists(inputFileName))
		{
			return "File Is Missing";
		}
		try
		{
			//判断是否已经安装Acrobat
			string acrobatPath = GetAppPath();
			if (acrobatPath == null)
			{
				return "Adobe Acrobat not installed.";
			}

			var aVDoc = new AcroAVDoc();
			aVDoc.Open(inputFileName, "");
			CAcroPDDoc PDDoc = (CAcroPDDoc)aVDoc.GetPDDoc();
			object jsObj = PDDoc.GetJSObject();
			var jsObjType = jsObj.GetType();
			//另存为
			jsObjType.InvokeMember(
							"saveAs",
							BindingFlags.InvokeMethod |
							BindingFlags.Public |
							BindingFlags.Instance,
							null, jsObj, new object[] { outputFileName, "com.adobe.acrobat.xlsx" });
/*
另存为更多格式
html htm      com.adobe.acrobat.html
jpeg jpg      com.adobe.acrobat.jpeg
docx          com.adobe.acrobat.docx
doc           com.adobe.acrobat.doc
png           com.adobe.acrobat.png
ps            com.adobe.acrobat.ps
rft           com.adobe.acrobat.rft
xlsx          com.adobe.acrobat.xlsx
xls           com.adobe.acrobat.spreadsheet
txt           com.adobe.acrobat.accesstext
tiff tif      com.adobe.acrobat.tiff
xml           com.adobe.acrobat.xml-1-00
*/
			//关闭文档
			aVDoc.Close(1);
		}
		catch (Exception ex)
		{
			return "Error:" + ex.Message;
		}
		return null;
	}
	
	//获取Acrobat安装路径
	private string GetAppPath()
	{
		string acrobatPath = null;
		using (RegistryKey acrobatRegistryKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Adobe\Adobe Acrobat"))
		{
			if (acrobatRegistryKey == null)
			{
				return acrobatPath;
			}
			string acrobatVersion = acrobatRegistryKey.GetValue("TrackName").ToString();
			using (RegistryKey acrobatInstallPathRegistryKey = acrobatRegistryKey.OpenSubKey(acrobatVersion + @"\InstallPath"))
			{
				if (acrobatInstallPathRegistryKey == null)
				{
					return acrobatPath;
				}
				acrobatPath = acrobatInstallPathRegistryKey.GetValue("").ToString() + @"\Acrobat.exe";
			}
		}
		return acrobatPath;
	}
}