Breadcrumbs

STImgCtl – Document Management

LoadDocument method

This method is used to load a file from a local drive, or from the internet or intranet via an HTTP URL.

If a document is loaded with LoadDocument and modified in form field mode, the original document will be overwritten when the mode is deactivated. Please read the notes in the section on form field mode!

The following formats are supported:

  • PDF

  • TIFF

  • BMP

  • PNG

  • EMF

  • JPG


C#
int LoadDocument(string bstrFilename);
C++
long LoadDocument(BSTR bstrFilename);

Parameter


In

Out

Possible

Values

Description

bstrFilename

✔️


!= NULL

File path or HTTP URL

Return value

Description

0

Method was executed successfully

< 0

An error has occurred


-4

The specified file could not be opened

LoadDocument2 method

This method is used to load a PDF document that is available in the form of a byte array.

C#
int LoadDocument2(object objBinaryArray);
C++
long LoadDocument2(VARIANT varBinaryArray);

Parameter


In

Out

Possible

Values

Description

objBinaryArray

✔️


0

A byte array

varBinaryArray

✔️


0

A variant with the properties VT_ARRAY and VT_UI1

Return value

Description

0

Method was executed successfully

< 0

An error has occurred


-2

Invalid input


-4

Input could not be read

GetFilename method

This method returns the file path of the displayed document.

C#
string GetFilename();
C++
BSTR GetFilename();

Return value

Description

Empty string

An error has occurred or no document is loaded

“VARIANT”

Document loaded with LoadDocument2, no file path available

File path or URL

Path or URL of the loaded document

SaveDocument method

This method returns the modified document as byte array in a VARIANT of type VT_ARRAY.

Exporting a PDF document with SaveDocument rewrites the entire document. This will invalidate any signatures already included.

C#
object SaveDocument();
C++
VARIANT SaveDocument();

Return value

Description

Byte array, size 0

An error has occurred

Byte array, size > 0

Updated content of the document

ClearDisplay method

This method removes the displayed document and clears the display.

C#
void ClearDisplay();
C++
void ClearDisplay();

ImageDisplayed property

This property can be used to query whether is document is currently displayed.

C#
int ImageDisplayed;
C++
long ImageDisplayed;

In

Out

Possible

Values

Description


✔️

0

No document is displayed in the display window

1

A document is displayed in the display window

DocumentType property

This property can be used to query the document type.

C#
short DocumentType;
C++
short DocumentType;

In

Out

Possible

Values

Description


✔️

0

BMP

1

PDF

2

EMF

3

GIF

4

JPG

5

TIFF

6

PNG

7

Unknown