IWorkspaceItem

What it does

Represents an item of the workspace. Can be a batch, a document or a page.

Methods
Definition Description
ApplyAutoLevelsFilter()

Important! This method is applicable only to gray and color images.

Automatically configures settings and applies the AdjustLevels filter.

ApplyPageProfile( name: string, [optional] onlyModificators: bool )

Applies the selected enhancement profile to an image.

Example

ApplyShadowsHighlightsFilter()

Important! This method is applicable only to gray and color images.

Applies a locally adaptive image contrast enhancement.

ApplySigmaFilter()

Important! This method is applicable only to gray and color images.

Applies a sigma filter to delete digital noise from images.

AutoCrop( [optional] type: string ) Automatically searches for page boundaries on an image, crops the area that contains data for extraction, corrects skews and distortions. Possible values of the optional type are Photo, Scan, Generic.
BackToSourceImage() Allows you to get back to a source image.
ChangeResolution (int) Changes image resolution on a page (or all pages) of a document or a batch to the specified value.
ConvertToBW ( ) Converts a page (or all pages) of a document or a batch to black-and-white.
Copy (target: IWorkspaceItem, [optional] inside: bool): IWorkspaceItem Copies a document or a page after the target item, or inside it. A target can be batch, document or page. Insertion can be made after the target at the same level (if the inside parameter is set to "false") or inside the target to the beginning of the list (if the inside parameter is set to "true").
CorrectBrightness(  brightness: int )

Important! This method is applicable only to gray and color images.

Corrects brightness of an image. Possible values are from -100 to 100.

CorrectContrast( contrast: int )

Important! This method is applicable only to gray and color images.

Corrects contrast of an image. Possible values are from -100 to 100.

Crop (rect: IPageRect) Crops an area on a page (or all pages) of a document or a batch.
Deskew ([optional] byLines: bool, [optional] byBlackSquares: bool, [optional] byText: bool) Deskews a page (or all pages) of a document or a batch. By default, byLines and byBlackSquares parameters are set to "false" while byText parameter is set to "true".
Despeckle ([optional] garbageSize: VARIANT) Despeckles a page (or all pages) of a document or a batch.
Erase (rect: IPageRect, [optional] rColor: int, [optional] gColor: int, [optional] bColor: int) Erases an area on a page (or all pages) of a document or a batch.
FlipHorizontal ( ) Flips a page (or all pages) of a document or a batch horizontal.
FlipVertical ( ) Flips a page (or all pages) of a document or a batch vertical.
FreeScale (newWidth: int, newHeight: int, newResolution: int) Scales a page (or all pages) of a document or a batch according to specified values.
Invert ([optional] rect: IPageRect) Inverts a page (or all pages) of a document or a batch.
IsPhoto: bool Shows whether an image is a photo.
IsSuitableForOcr: bool Shows whether an image is suitable for OCR.
Move (target: IWorkspaceItem, [optional] inside: bool) Moves a document or a page after the target item, or inside it. A target can be batch, document or page. Insertion can be made after the target at the same level (if the inside parameter is set to "false") or inside the target to the beginning of the list (if the inside parameter is set to "true").
RemoveGeometricalDistortions() Corrects geometrical distortions of trapeziums and crooked lines on an image.
RemoveMotionBlur()

Important! This method is applicable only to gray and color images.

Detects and removes blur that is caused by moving a document or a camera/scanner.

RemoveScannerShadowFromImage() Removes shadow from a scanner (for example, in the center spread).
RemoveStamps (colorToFilter: string, [optional] rect: IPageRect)

Important! This method can only be applied to color images.

Removes stamps from images.

  • colorToFilter
    The color of the stamps you want to remove. Accepts string values Red, Green, Blue, and Yellow (not case-sensitive).
  • rect
    The area of the image from which you want to remove stamps. If this parameter is not specified, stamps will be removed from the entire image.

Example

RemoveStampsExt (colorsToFilter: string)

Important! This method is applicable only to color images.

Removes stamps from images:

colorsToFilter - color of stamps for deletion.

  • String values: Red, Green, Blue, Yellow, Orange, LightBlue, Purple (regardless of register).
  • You can specify several values separated by a comma (for example, "Red, Green").
  • You can also specify a blank line as a value (""). In this case, colors to be deleted are selected automatically. The program will delete all colors found on an image from the set of allowable values.

Example

An example of a script that deletes red and green stamps and marks from all document pages:

foreach( IWorkspaceItem item in Workspace.Selection )
{
if (item.PageInfo.IsColor)
{
item.RemoveStampsExt("Red,Green");
}
}

ResetPageProfile() Resets the image enhancement profile and discards all changes.
Rotate (angle: int) Rotates a page (or all pages) of a document or a batch.
SaveAs (fileName: string, [optional] options: IImageSavingOptions)

Saves pages/a page image/a batch to a file.

When saving a multi-page document (or a batch) in a single-page format, an exception is returned.

Scale (ratio: int) Scales a page (or all pages) of a document or a batch relative to the basic value of 100.
SplitHorizontal (pos: int) Splits a page (or all pages) of a document or a batch horizontal.
SplitVertical (pos: int) Splits a page (or all pages) of a document or a batch vertical.
SuitabilityForOCR: float Shows how suitable is an image for OCR. Possible values are from 0.0 to 1.0.
Properties
Name Type Access Description
Attachments IAttachments Read-only Attachments
BatchInfo (DocumentInfo or PageInfo) IBatchInfo/ IDocumentInfo / IExportPageInfo Read-only Item properties. If the requested property does not correspond to the item type, the IsBatch (IsDocument or IsPage) check is carried out.
Children IWorkspaceItems Read-only Child items
IsBatch (IsDocument or IsPage) bool Read-only Specifies whether the item is a batch, a document or a page
IsExported bool Read/write Specifies whether the item is exported. Can be modified only for batch items in pre-export scripts.
IsSelected bool Read/write

Specifies whether the item is selected. Changing this property value for a particular item does not affect other items.

Does not work, if the current selection consists of elements of a different type.

Index int Read-only The item index in the parent collection
Name string Read/write* The item name
Next IWorkspaceItem Read-only The next item
Parent IWorkspaceItem Read-only The parent item
Prev IWorkspaceItem Read-only The previous item
ScriptProperties IScriptProperties Read-only Script properties

* – Note. If IWorkspaceItem is used to represent a page, the Name property is read-only.

25.05.2023 7:55:03

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.