# Quick Start

## Content



This quick start gets you started with PrintDocument by letting you create a WPF application, add basic previewing control like the DocumentViewer to it.

![](https://cdn.mescius.io/document-site-files/images/e29a4461-e07b-44c3-94f3-5fcd6ed96aaf/images/printdoc-buttonclick.png)

To quickly get started using PrintDocument, follow these steps:

## Add DocumentViewer

1.  Create a WPF app in Visual Studio.
2.  Add the C1.Xaml.WPF.PrintDocument nuget package.
3.  Drag and drop the document-viewing control **C1.WPF.PrintDocument.C1DocumentViewer** from the Toolbox to the form.
4.  Drag and drop a Button control from the Toolbox to your form. Arrange both DocumentViewer and Button on the form as given in the image above.

## Configure PrintDocument

1.  Switch to the code view and add C1.Preview namespace:
    
    ```csharp
    using C1.C1Preview;
    ```
    
2.  Add the following code to the **Button\_Click** event to add text to the preview document and generate the document.
    
    ```csharp
    private void button_Click(object sender, RoutedEventArgs e)
    {
        C1.C1Preview.C1PrintDocument doc = new C1.C1Preview.C1PrintDocument();
        doc.Body.Children.Add(new RenderText("Hello World!"));
        documentViewer.Document = doc.FixedDocumentSequence;
    }
    ```
    

## Build and Run the Project

1.  Click Build | Build Solution to build the project.
2.  Press F5 to run the project.
3.  Observe some of the run-time interactions with the preview control.
    
    ![](https://cdn.mescius.io/document-site-files/images/e29a4461-e07b-44c3-94f3-5fcd6ed96aaf/images/pritndoc-renderobject.gif)