[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

PDF display

hello I have to display a pdf file in my c# application (Windows.Form ).
I know we can use some acrobat control but no idea on it.
Can anybody give me a sample program on it.
Once again I just want to display a PDF file on windows forms and it will be used in a commercial product.

Thanks
0
uttam80
Asked:
uttam80
1 Solution
 
_dataking_Commented:
In visual studio 2003 .net you can do the following assuming you have the adobe pdf reader installed

1) open the form or user control in which the pdf control should appear in the gui designer
2) in the toolbox pane right click and select add/remove items
3) select COM components from the customize toolbox menu2
4) select and insert the "Adobe Acrobat Control for ActiveX" by double clicking it and clicking ok
5) drag it into your form or control in the designer
6) assuming the pdf control has the name axPdf1 (the default name) use the following code to load and display a pdf document (change the filename appropriately), the code shown loads the file when the containing form is shown the first time using the load event.

private void Form1_Load(object sender, System.EventArgs e)
 {
            axPdf1.LoadFile(@"c:\test.pdf");
}

Hope this works for you too!

PS: you can also easily start the pdf application (if installed) externally by executing
System.Diagnostics.Process.Start(@"c:\test.pdf");
0
 
uttam80Author Commented:
Hello I did not had visual studio 2003 but still I found a way
thanks.
0
 
phunchakCommented:
This works way easier....nice tip!

System.Diagnostics.Process.Start(@"c:\test.pdf");
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now