Soumyaansh
Soumyaansh

Reputation: 8988

c# : How to show/preview PDF inside in winforms Application?

I want to show/preview local pdf files in a winforms application ()

Currently I am using Webbrowser control and tried the Navigate(uri) method but it is launching the PDF file with third party interface

Below are few highly voted answers related to the same context but unfortunately it didn't help me as the solution involves dependency of showing pdf using already installed pdf viewer in the system (Acrobat/Nirto/IE etc)

Please let me know if its possible to show the pdf without using third party packages.

Viewing PDF in Windows forms using C#

Displaying a pdf file from Winform

Upvotes: 4

Views: 10194

Answers (1)

Yahfoufi
Yahfoufi

Reputation: 2544

First Method :

Use the Adobe PDF reader COM Component

  1. Navigate to the toolbox and right click to "Choose Items"
  2. Choose the "COM Components" tab
  3. Choose"Adobe PDF Reader" then click OK
  4. Drag & Drop the control to the form you want to view the PDF IN
  5. Specify the PDF file you want to read by modifing the "src" Property

Second Method :

add a WebBrowser Control into your Form and open the file by using the Navigate Method AddedwebBrowserControl.Navigate(@"c:\IntroductiontoSqlServer.pdf");

EDIT : If you dont have adobe reader installed on your machine , then the First Method will Not work for you

Upvotes: 4

Related Questions