using System.Xml;
using System.IO;
namespace Ebookss
{
public partial class Ebook : Form
{
string path = "D:\\samples";
public Ebook()
{
InitializeComponent();
listdirectory(treeView1, path);
}
private void listdirectory(TreeView treeview, string path)
{
treeview.Nodes.Clear();
var treeviewinfo = new DirectoryInfo(path);
treeview.Nodes.Add(createDN(treeviewinfo));
}
private static TreeNode createDN(DirectoryInfo directoryinfo)
{
var directorynode = new TreeNode(directoryinfo.Name);
foreach (var directory in directoryinfo.GetDirectories())
{
directorynode.Nodes.Add(createDN(directory));
}
foreach (var file in directoryinfo.GetFiles())
{
directorynode.Nodes.Add(new TreeNode(file.Name));
}
return directorynode;
}
private void homeToolStripMenuItem_Click(object sender, EventArgs e)
{
string treenodename = treeView1.SelectedNode.ToString().Replace("TreeNode:", string.Empty);
MessageBox.Show(path + "\\" + treenodename);
this.adobe.LoadFile(path + "\\" + treenodename);
}
public object fileUri { get; set; }
}
}
Asked
Active
Viewed 414 times
-1

Alex
- 2,681
- 3
- 28
- 43

Bipzz Thapa
- 9
- 1
1 Answers
0
You can use Process.Start()
to start executable files in C#. The .pdf-file is acutally just a parameter you give to the reader. Try this:
string cPath = @"C:Program Files (x86)\Adobe\Reader 11.0\Reader\"; // Path to adobe reader
string cParams = @"C:\temp\d.pdf"; // File you want to Open
string filename = Path.Combine(cPath, "AcroRd32.exe");
Process proc = Process.Start(filename, cParams);
Here's a similar question.
-
Glad to help, if this answer solved your problem please mark it as accepted by clicking the check mark next to the answer. see: [How does accepting an answer work?](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) for more information – Dominik B Apr 27 '15 at 13:27
-
sir, i need to disable right click and hide toolbar from it for security reason in windows form? – Bipzz Thapa Apr 28 '15 at 05:54
-
@Bipzz Thapa You need to disable that in Adobe Reader? I'm not sure if you can do that., just like this. Can you even do this when using Adobe Reader without a program? Maybe check the parameters that you can give to Adobe Reader.. – Dominik B Apr 28 '15 at 05:59
-
sir, actually i want to show up doc. and pdf. type file in windows form and want to provide security to these through UI too. Can you give me any suggestion or valuable links? – Bipzz Thapa Apr 28 '15 at 06:07
-
How about you use a WebBrowser-Control and navigate to your file? [Here](http://stackoverflow.com/questions/4504442/viewing-pdf-in-windows-forms-using-c-sharp)'s a similar question that you might want to check out. – Dominik B Apr 28 '15 at 06:10