Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / ImportImage Method
Path of symbol file.
Position of the image.
Height of the image in the designer.
Width of the image in the designer.
Example
In This Topic
    ImportImage Method (Designer)
    In This Topic
    Import image into designer.
    Syntax

    Parameters

    path
    Path of symbol file.
    position
    Position of the image.
    height
    Height of the image in the designer.
    width
    Width of the image in the designer.

    Return Value

    Imported image.
    Exceptions
    ExceptionDescription
    Api is not in an initialized state. You can get current state from EPLAN.Harness.API.HpdApi.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.HpdApi.Init method. If API is in failed state, you can not resurrect it.
    The object is in invalid state. Obtain a new one.
    This file is not opened.
    Remarks
    One dimension (height or width) can be null, it will be computed from the other one, keeping original aspect ratio. Supported extensions:
    • bmp
    • gif
    • jpg
    • jpeg
    • png
    • tif
    • tiff
    • rgb
    Example
    This example shows how to import an image to workspace (keep aspect ratio).
    Workspace workspace = ...
    
    string path = ...;
    TransformProperty<LengthProperty> position = ...;
    LengthProperty height = ...;
    
    IOccImage image = workspace.ImportImage(path, height, null);
    This example shows how to import image to workspace (doesn't keep aspect ratio).
    Workspace workspace = ...
    
    string path = ...;
    TransformProperty<LengthProperty> position = ...;
    LengthProperty height = ...;
    LengthProperty width = ...;
    
    IOccImage image = workspace.ImportImage(path, height, width);
    See Also