# Dictionary

Learn about dictionary feature in PrintDocument from this WinForms documentation helpfile.

## Content



If one item (for example, an image or an icon) is used in several places in a document, you can store that item once in a location available from the whole document and reference that instance, rather than inserting the same image or icon in every place it is used. For that, [C1PrintDocument](/componentone/docs/win/online-printdocument/) provides a dictionary.

To access the dictionary, use the [Dictionary](/componentone/docs/win/online-printdocument/) property. The dictionary contains items of the base type [DictionaryItem](/componentone/docs/win/online-printdocument/), which is an abstract type. Two derived classes are provided, [DictionaryImage](/componentone/docs/win/online-printdocument/) and [DictionaryIcon](/componentone/docs/win/online-printdocument/), to store images and icons correspondingly. Items in the dictionary are referenced by names. In order to use an item, you must assign a name to it. The name must be unique within the dictionary.

Dictionary items may be used in the following places in the document:

*   As the background image of a style, using the property [BackgroundImageName](/componentone/docs/win/online-printdocument/).
*   As the image in a [RenderImage](/componentone/docs/win/online-printdocument/) object, using the property [ImageName](/componentone/docs/win/online-printdocument/).

So, if in your document the same image is used in several places, do the following:

*   Add the image to the dictionary, for instance like this:
    
    ```csharp
    this.c1PrintDocument1.Dictionary.Add(new DictionaryImage("image1", Image.FromFile(@"Resources\OIP.jpg")));
    ```
    
*   Use that image by setting either the BackgroundImageName on styles, or the ImageName property on render images, for example, like this:
    
    ```csharp
    RenderImage ri = new RenderImage();
    ri.ImageName = "image1";
    ```