在C#中的指定页面打开pdf文件 [英] Open a pdf file at a specified page in C#

查看:436
本文介绍了在C#中的指定页面打开pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在用C#编写一个程序

我想以pdf文件的形式打开一个word文档,我需要打开一个指定的文件页面



我试过在谷歌找到这个溶液



处理myProcess = new Process(); 
myProcess.StartInfo.FileName =AcroRd32Info.exe;
myProcess.StartInfo.Arguments =/ A \page = 2 \D:\\Doc1.pdf;
myProcess.Start();





但它不起作用,我希望pdf文件指向特定的页面



谢谢和问候,

Divya



代码块整理出来 - OriginalGriff [/编辑]

解决方案

尝试更改此内容:

 myProcess.StartInfo.Arguments =/ A \页面= 2 \D:\\Doc1.pdf; 

 myProcess.StartInfo.Arguments =/ A \page = 2 \\ D:\\Doc1.pdf \; 

来自http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf [ ^ ]


< blockquote> ProcessStartInfo startInfo = new ProcessStartInfo(@C:\Program Files \Adobe\Reader11.0\Rea der\AcroRd32.exe,/ A page = 250 C:\\SampleDotNet.pdf);

startInfo.WindowStyle = ProcessWindowStyle.Maximized;

Process.Start(startInfo);


您使用的进程是为Acrobat 7编写的,而不是为Acrobat Reader编写的。读者没有这个命令行选项。

根据一些消息来源,读者唯一可用的命令行选项是:



AcroRd32 .exe< filename>



提供以下开关:



* / n - 启动读者的新实例如果已经打开

* / s - 不显示启动画面

* / o - 不显示打开的文件对话框

* / h - 作为最小化窗口打开

* / p< filename> - 打开并直接进入打印对话框

* / t< filename> <打印机名称> <驱动程序名> <端口名> - 打印指定打印机的文件。



这些被发现此处

Hello,
I'm writing a program in C#
I want to open a word document in form of pdf file and in that i need to open a specified page

I have tried with this soln found in google

Process myProcess = new Process();
myProcess.StartInfo.FileName = "AcroRd32Info.exe";
myProcess.StartInfo.Arguments = "/A \"page=2\"D:\\Doc1.pdf";
myProcess.Start();



but it is not working,I want the pdf file to point to the particular page

Thanks and Regards,
Divya

[edit]Code block sorted out - OriginalGriff[/edit]

解决方案

Try changing this:

myProcess.StartInfo.Arguments = "/A \"page=2\"D:\\Doc1.pdf";

To

myProcess.StartInfo.Arguments = "/A \"page=2\" \"D:\\Doc1.pdf\"";

This from http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf[^]


ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\Program Files\Adobe\Reader11.0\Reader\AcroRd32.exe", "/A page=250 C:\\SampleDotNet.pdf");
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);


The process you are using is written for Acrobat 7, and not for the Acrobat Reader. The reader does not have this command line option.
According to some sources the only available command line options for the reader are:

AcroRd32.exe <filename>

The following switches are available:

* /n - Launch a new instance of Reader ever if one is already open
* /s - Don't show the splash screen
* /o - Don't show the open file dialog
* /h - Open as a minimized window
* /p <filename> - Open and go straight to the print dialog
* /t <filename> <printername> <drivername> <portname> - Print the file the specified printer.

These were found here


这篇关于在C#中的指定页面打开pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆