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 provides a dictionary.
To access the dictionary, use the Dictionary property. The dictionary contains items of the base type DictionaryItem, which is an abstract type. Two derived classes are provided, DictionaryImage and DictionaryIcon, 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:
So, if in your document the same image is used in several places, do the following:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1PrintDocument1.Dictionary.Add(New C1.C1Preview.DictionaryImage("image1", Image.FromFile("myImage.jpg"))) |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1PrintDocument1.Dictionary.Add(new DictionaryImage("image1", Image.FromFile("myImage.jpg"))); |
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim ri As New C1.C1Preview.RenderImage() ri.ImageName = "image1" |
To write code in C#
C# |
Copy Code
|
---|---|
RenderImage ri = new RenderImage(); ri.ImageName = "image1"; |