簡體   English   中英

無法使用C#代碼在Adobe Reader 11中的特定頁面上打開pdf文件

[英]unable to open a pdf file at specific page in Adobe Reader 11 using C# code

以下代碼行用於在C#中的特定頁面上打開PDF文件。 代碼對於除最新版本之外的所有adobe版本都非常好,即11。

System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "AcroRd32.exe";
myProcess.StartInfo.Arguments = "/A \"page=2=OpenActions\" C:\\Jack and Jill.pdf";
myProcess.Start();

有人可以幫助我,讓我們知道adobe reader 11的特殊之處。任何幫助都將不勝感激。

錯誤是“打開此文檔時出錯。無法找到該文件。” (文件存在)

PS:我已經卸載了adobe 11並安裝了adobe reader 10,然后代碼工作正常。

當安裝Acrobat Reader 11時從命令行給出的參數也正常工作並打開PDF。

確保文件名中沒有空格。 它可以工作,如果它在所有其他adobe讀者中有空格,但adobe reader 11 dosent支持它。

希望這可以幫助

根據打開PDF文件的參數,您的參數行應如下所示:

myProcess.StartInfo.Arguments = "/A \"page=2\" C:\\example.pdf";

確保文件C:\\ example.pdf存在。 沒有文件時會發生此錯誤。

string pdfPath = @"C:\example.pdf";

if (System.IO.File.Exists(pdfPath))
{
     System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
     myProcess.StartInfo.FileName = "AcroRd32.exe";
     myProcess.StartInfo.Arguments = string.Format("/A \"page=2=OpenActions\" \"{0}\"", pdfPath);
     myProcess.Start();
}

Reader 11的打開參數已更改或已刪除。 使用Reader 10.我已經向Adobe詢問了有關讀者11的Open參數的信息,但沒有回復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM