I\'m just creating a simple calculator in C# (windows form)
I\'ve created a \"User Help\" which is a pdf file, what I want is to display that pdf file if the user cl
You could use the WebBrowser control and let IE load a PDF reader for you if there is one installed on the machine.
However the last time I tried this, I had to write the PDF file to disk first, so I could point the WebBrowser control at it.
There is a C# pdf viewer project on google code. http://code.google.com/p/pdfviewer-win32/ there is the viewer and there is the library that it uses available that uses mupdf and xpdf to render the pdf documents in your winforms program. I am currently developing a User control library for people to use and drop into their programs for pdf viewing capabilities. it works pretty good.
If your user has Adobe Reader (or any other PDF reader) installed on their machine, you could use:
System.Diagnostics.Process.Start(
"My-PDF-file.pdf");
Hope this helps.
Note: Obviously, this will fail if the user does not have any PDF Reader applications installed.
AxAcroPDF1.LoadFile("C:ShippingForm.pdf")
AxAcroPDF1.src = "C:ShippingForm.pdf"
AxAcroPDF1.setShowToolbar(False)
AxAcroPDF1.setView("fitH")
AxAcroPDF1.setLayoutMode("SinglePage")
AxAcroPDF1.setShowScrollbars(False)
AxAcroPDF1.Show()
You can reference the Adobe Reader ActiveX control and bundle it with your application.
Simply add AcroPDF.PDF.1
to your Toolbox from the COM Components tab (right click toolbox and click Choose Items...
) then drag an instance onto your Winform to have the designer create the code for you. Alternately, after adding the necessary reference you can use the following code:
AxAcroPDFLib.AxAcroPDF pdf = new AxAcroPDFLib.AxAcroPDF();
pdf.Dock = System.Windows.Forms.DockStyle.Fill;
pdf.Enabled = true;
pdf.Location = new System.Drawing.Point(0, 0);
pdf.Name = "pdfReader";
pdf.OcxState = ((System.Windows.Forms.AxHost.State)(new System.ComponentModel.ComponentResourceManager(typeof(ViewerWindow)).GetObject("pdfReader.OcxState")));
pdf.TabIndex = 1;
// Add pdf viewer to current form
this.Controls.Add(pdf);
pdf.LoadFile(@"C:\MyPDF.pdf");
pdf.setView("Fit");
pdf.Visible = true;