Table of Contents

Class ImageHandlerUtil

Namespace
iText.IO.Util
Assembly
itext.io.dll
public sealed class ImageHandlerUtil
Inheritance
ImageHandlerUtil
Inherited Members

Constructors

ImageHandlerUtil()

public ImageHandlerUtil()

Fields

GHOSTSCRIPT_ENVIRONMENT_VARIABLE

The name of the environment variable with the command to execute Ghostscript operations.

public const string GHOSTSCRIPT_ENVIRONMENT_VARIABLE = "ITEXT_GS_EXEC"

Field Value

string

GHOSTSCRIPT_ENVIRONMENT_VARIABLE_LEGACY

[Obsolete]
public const string GHOSTSCRIPT_ENVIRONMENT_VARIABLE_LEGACY = "gsExec"

Field Value

string

GHOSTSCRIPT_KEYWORD

public const string GHOSTSCRIPT_KEYWORD = "GPL Ghostscript"

Field Value

string

GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED

public const string GS_ENVIRONMENT_VARIABLE_IS_NOT_SPECIFIED = "Ghostscript command is not specified. Set the ITEXT_GS_EXEC environment variable to a CLI command that can run the Ghostscript application. See BUILDING.MD in the root of the repository for more details."

Field Value

string

MAGICK_COMPARE_ENVIRONMENT_VARIABLE

The name of the environment variable with the command to execute ImageMagic comparison operations.

public const string MAGICK_COMPARE_ENVIRONMENT_VARIABLE = "ITEXT_MAGICK_COMPARE_EXEC"

Field Value

string

MAGICK_COMPARE_ENVIRONMENT_VARIABLE_LEGACY

[Obsolete]
public const string MAGICK_COMPARE_ENVIRONMENT_VARIABLE_LEGACY = "compareExec"

Field Value

string

MAGICK_COMPARE_KEYWORD

public const string MAGICK_COMPARE_KEYWORD = "ImageMagick Studio LLC"

Field Value

string

UNABLE_TO_CREATE_DIFF_FILES_ERROR_MESSAGE

public const string UNABLE_TO_CREATE_DIFF_FILES_ERROR_MESSAGE = "Unable to create files with differences between pages because ImageMagick comparison command is not specified. Set the ITEXT_MAGICK_COMPARE_EXEC environment variable with the CLI command which can run the ImageMagic comparison. See BUILDING.MD in the root of the repository for more details."

Field Value

string

Methods

GetCompareExec()

public string GetCompareExec()

Returns

string

GetGsExec()

public string GetGsExec()

Returns

string

IsVersionCommandExecutable(string)

Checks if the specified by input parameter tool's system variable is correctly specified and the specified tool can be executed.

public bool IsVersionCommandExecutable(string keyWord)

Parameters

keyWord string

the keyword specifying the tool (GhostScript or ImageMagick)

Returns

bool

boolean result of checking: true - System variable is correctly specified and the specified tool can be executed

RunGhostScriptImageGeneration(string, string, string)

Runs ghostscript to create images of pdfs.

public void RunGhostScriptImageGeneration(string pdf, string outDir, string image)

Parameters

pdf string

Path to the pdf file.

outDir string

Path to the output directory

image string

Path to the generated image

RunGhostScriptImageGeneration(string, string, string, string)

Runs ghostscript to create images of specified pages of pdfs.

public void RunGhostScriptImageGeneration(string pdf, string outDir, string image, string pageNumber)

Parameters

pdf string

Path to the pdf file.

outDir string

Path to the output directory

image string

Path to the generated image

pageNumber string

Number of the required page of pdf to extract as image. Can be null, if it is required to extract all pages as images

RunImageMagickImageCompare(string, string, string)

Runs imageMagick to visually compare images and generate difference output.

public bool RunImageMagickImageCompare(string outImageFilePath, string cmpImageFilePath, string diffImageName)

Parameters

outImageFilePath string

Path to the output image file

cmpImageFilePath string

Path to the cmp image file

diffImageName string

Path to the difference output image file

Returns

bool

boolean result of comparing: true - images are visually equal

RunImageMagickImageCompare(string, string, string, string)

Runs imageMagick to visually compare images with the specified fuzziness value and generate difference output.

public bool RunImageMagickImageCompare(string outImageFilePath, string cmpImageFilePath, string diffImageName, string fuzzValue)

Parameters

outImageFilePath string

Path to the output image file

cmpImageFilePath string

Path to the cmp image file

diffImageName string

Path to the difference output image file

fuzzValue string

fuzziness value to compare images. Can be null, if it is not required to use fuzziness

Returns

bool

boolean result of comparing: true - images are visually equal

SetCompareExec(string)

public void SetCompareExec(string newCompareExec)

Parameters

newCompareExec string

SetGsExec(string)

public void SetGsExec(string newGsExec)

Parameters

newGsExec string