TX Text Control .NET Server

ImageCollection Class

Class
Namespace
TXTextControl
Package
TXTextControl.TextControl.Core.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Core.dll
Install
dotnet add package TXTextControl.TextControl.Core.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.dll from the setup.
Also in
TXTextControl.TextControl.ASP.SDK as TXTextControl.dll
Inherits
  1. FrameBaseCollection
  2. ImageCollection
Implements
ICollection, IEnumerable

Description

An instance of the ImageCollection class contains all images in a Text Control document or part of the document represented through objects of the type Image. An instance of this class can be obtained with the TextControl.Images, HeaderFooter.Images or TextFrame.Images property. The ImageCollection class implements the IEnumerable and the ICollection interfaces.

Syntax

public sealed class ImageCollection : FrameBaseCollection

Examples

The following example iterates all images and sets the Image.SaveMode to SaveAsFileReference, so that all images will be exported the next time the document is saved. The images, will be saved in a subfolder called "'document name'_Images" of the location where the document has been saved to. The additional properties can be used to set the image's quality, format and maximum resolution.

foreach (TXTextControl.Image myImage in textControl1.Images)
{
  myImage.SaveMode = TXTextControl.ImageSaveMode.SaveAsFileReference;
  myImage.ExportCompressionQuality = 100; //Export with maximum quality
  myImage.ExportFilterIndex = 4; //Export as PNG format
  myImage.ExportMaxResolution = 96; //Export with 96 DPI max
}

The following example works with images in the current document.

ImageCollection imageCollection = textControl.Images;
imageCollection.Add(new TXTextControl.Image { FileName = @"Images\company-logo.png", Name = "CompanyLogo" }, -1);

Members

Properties

PropertyDescription
CountGets the number of elements contained in the collection. (Inherited from FrameBaseCollection.)
ExportFiltersGets all available filters for exporting images. This property can be used to set the FileDialog.Filter property.
ImportFiltersGets all available filters for importing images. This property can be used to set the FileDialog.Filter property.
IsSynchronizedReturns true if the collection is designed to be thread safe, otherwise, it returns false. (Inherited from FrameBaseCollection.)
SyncRootGets an object that can be used to synchronize access to the collection. (Inherited from FrameBaseCollection.)

Methods

MethodDescription
AddInserts a new image in a Text Control document.
ClearRemoves all objects from the collection and from the document. (Inherited from FrameBaseCollection.)
CopyToCopies the elements of the collection to an array, starting at a particular index.
GetEnumeratorReturns an enumerator that can be used to iterate through the collection. (Inherited from FrameBaseCollection.)
GetItemGets a particular image from the collection.
RemoveRemoves an image from a Text Control document.

Further Reading