# Quick Start

Learn how to create an app using PdfDocumentSource.

## Content



This Quick Start guides you through a step-by-step process of creating a simple application for loading a PDF document using PdfDocumentSource and viewing it in [FlexViewer](https://www.grapecity.com/componentone/docs/win/online-flexreport/overview.html), a lightweight viewer control.

The following image shows a PDF document rendered in FlexViewer.

![Flexviewer app snapshot](https://cdn.mescius.io/document-site-files/images/a0c58113-bcd8-49ac-b5d4-2d50837f0be4/images/flexviewer-showing-pricecomparisonpdf.png)

## Load and view document using designer

To load and view a PDF document using the **PdfDocumentSource** component and **FlexViewer** control, follow the steps below:

1.  Create a new **WinForms** application.
2.  Navigate to the Toolbox, drag and drop **FlexViewer** control on the form. Adjust the position and size of **FlexViewer** according to your requirement.
3.  Drag and drop **PdfDocumentSource** component on the form. It appears in the form's component tray.
4.  In **Properties** Window, go to the FlexViewer's properties, and assign the name of the **PdfDocumentSource** component to the **DocumentSource** property value field. This property gets the PDF document source shown by FlexViewer.
5.  Select **PdfDocumentSource** component and navigate to its properties in the Properties window. Add the full path of the PDF document to the **DocumentLocation** property. This fetches the location of the document in the PdfDocumentSource component .
6.  Build and run the application. The PDF is rendered in the FlexViewer control.

## Load and view document using code

To load and view a PDF document using the **PdfDocumentSource** component and **FlexViewer** control, follow the steps below:

### Step 1: Set up the application

1.  Create a new WinForms application.
2.  Drag and drop the **FlexViewer** on the form.
3.  Add a PDF document to the project.

### Step 2: Load the document in FlexViewer

1.  Switch to the code view and add the following namespace.
    
    ```csharp
    using C1.Win.Document;
    ```
    
2.  Double-click the form and write the following code in the **Form\_Load** event to create an instance of **C1PdfDocumentSource** class and load the PDF document using the **LoadFromFile** method.
    
    ```csharp
    C1PdfDocumentSource pds = new C1PdfDocumentSource();
    pds.LoadFromFile(@"..\..\DefaultDocument.pdf");
    ```
    
3.  Render the PDF document in the FlexViewer control using **DocumentSource** property in the same event.
    
    ```csharp
    flexViewer.DocumentSource = pds;
    ```
    

### Step 3: Build and run the project

1.  Press **Ctrl+Shift+B** to build the project.
2.  Press **F5** to run the application. View the PDF document in FlexViewer.