Skip to main content

Simple Example

Version: 2.0

Simple Example

Below demonstrates setting up a simple Visual Studio 2010, C# Windows Form Application using the DynamicPDF Viewer for .NET control. Make sure the latest version of the DynamicPDF Viewer for .NET evaluation edition MSI has been downloaded and installed (https://www.dynamicpdf.com/View-PDF-.NET.aspx). Many other examples (including full source code) are included with the evaluation edition MSI.

1. Create or open a C# Windows Form application in Visual Studio.

2. Open the Toolbox (Ctrl + Alt + X).

3. From the Toolbox (in the “General” section) drag the “PdfViewer” control onto the form.

4. Select the control and set its Name property to "pdfViewer".

5. Re-size, position and set any additional properties as needed.

6. Double click on an empty part of the form and add the following line of code to the Form_Load method: pdfViewer.Open(pdfFilePath);

Note: Make sure there is a valid PDF document in whatever location you specify above.

7. Run the application to see the PDF specified in step 6 appear on the form.

Note: These instructions will work with older versions of Visual Studio as well, with a few slight differences.

Documentation version