1. 程式人生 > >C#開啟Adobe Reader程序開啟pdf並傳遞頁碼引數跳轉到指定頁數

C#開啟Adobe Reader程序開啟pdf並傳遞頁碼引數跳轉到指定頁數

    參考文件:     http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf           

code:      

this.btnOpen.AvoidMultipleClick();

int pageNum = 1;
if (System.IO.File.Exists(_EMDGuidecardsPdfPath))
{
string adobeProcessName="AcroRd32";
System.Diagnostics.Process[] adobeProcessArr = System.Diagnostics.Process.GetProcessesByName(adobeProcessName);
if(adobeProcessArr.Length>0)
{
try
{
adobeProcessArr[0].Kill();
}
catch

}
}
pageNum = GetPageNum();
System.Diagnostics.Process adobeProcess = new System.Diagnostics.Process();
adobeProcess.StartInfo.FileName = adobeProcessName+".exe";
adobeProcess.StartInfo.Arguments = "/A \"page=" + pageNum + "=OpenActions\" \"" + _PdfPath + "\"";
try
{
adobeProcess.Start();
}
catch
{
MessageBox.Show("Please make sure the Adobe Reader is installed.");
}
}
else
{
MessageBox.Show("No EMD Guidecards PDF! Please login again.");
}