How to View PDF File inside the Form Using C#
Submitted by janobe on Monday, June 24, 2019 - 16:40.
In this tutorial, you will learn how to view PDF file inside the Form Using C#. PDF is the most commonly used by companies for their documents which includes images and text formatting.
You have to install a PDF Reader first in your machine in order to add it in the Microsoft Visual Studio 2015. Just visit the official site of adobe acrobat. Here is the link https://get.adobe.com/reader/
The complete source code is included. You can download it and run it on your computer.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.
Creating Application
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application for c#.
Step 2
Go to toolbars, right click and select choose items.
Step 3
When the “Choose ToolBox Items” appear, go to COM Components and check Adobe PDF Reader then hit OK.
Step 4
In the ToolBox, select PDF Reader, OpenFileDialog and a Button then drag it inside the form. Make the form just like shown below.
Step 5
Double click a Button and add the following code to get a PDF File and to view it into the form.- ofd.Filter = "PDF |*.pdf";
- if(ofd.ShowDialog() == DialogResult.OK)
- {
- axAcroPDF1.src = ofd.FileName;
- }
Comments
Add new comment
- Add new comment
- 1631 views