Click or drag to resize

IIQAPICreateDocument Method

Create a new document in ImageQuest with the specified index values and associated backing document.

Namespace:  Informa.ImageQuest.API.Library
Assembly:  Informa.ImageQuest.API.Library (in Informa.ImageQuest.API.Library.dll) Version: 14.3.0.0
Syntax
IQDocument CreateDocument(
	string token,
	List<IQDocumentAttribute> metadata,
	string filename,
	byte[] documentData
)

Parameters

token
Type: SystemString
User Authentication Token from a previous Login(String, String, String) or SystemLogin(String) call.
metadata
Type: System.Collections.GenericListIQDocumentAttribute
List of name/value pairs specifying the index values for the new document
filename
Type: SystemString
Name of the backing file to store into ImageQuest
documentData
Type: SystemByte
Contents of the backing file to store into ImageQuest

Return Value

Type: IQDocument
A valid ImageQuest IQDocument object with the associated backing file and index values.
Remarks

The metadata parameter is defined as a dynamically sized generic ListT containing IQDocumentAttribute objects. In most cases, the SOAP proxy class will serialize this value as a fixed-sized array of IQDocumentAttribute objects.

To add a document to the ImageQuest system, the API consumer must supply the index values along with the name and contents of the document file. The index values are represented as a list of metadata name/value pairs corresponding to the ImageQuest attributes associated with the document. The application must include at least one IQDocumentAttribute item with a Name of DocumentType, whose value must be one of the document types configured in the current cabinet. Additionally, each IQDocumentAttribute must have a Name which matches the name of an attribute configured in the current cabinet.

Documents created in this manner may include index values that are not directly associated with the document type, as long as they are vald attributes in the current cabinet. In this manner, an API consumer application may store "hidden" values that can be read and maniuplated via the API, but cannot be viewed in the ImageQuest desktop or web client applications.

All new documents being added to ImageQuest require a file name and file contents to be associated with the index values. It is not required for the file name to point to an existing physical file on the system, in cases where documents are being created directly from an in-memory data stream. The only requirement for the filename parameter is that it includes a file extension, which ImageQuest will use to determine the appropriate file type for viewing and previewing within the ImageQuest client applications. In particular, a filename consisting solely of a file extension is permitted.

In addition to the user-defined attributes configured via the ImageQuest administrator, newly-created documents are assigned a default set of system attributes that are present on all documents. The PageCount attribute should be set by the API consumer for multi-page documents. The remainder of these system attributes should be considered read-only, and may produce undesirable results if they are edited:

  • Deleted
  • CreateDateTime
  • FileID
  • FileType
  • EnteredBy

There are also a set of optional attributes which are used internally by ImageQuest to control various system functions. For example, if the boolean attribute NeedsOCR is set to True on a new document, and there is a TIF file associated with that document, it will be processed by the ImageQuest OCR service and converted into a searchable PDF.

See the documentation for the IQDocument class for details on the various special attributes and their functions.

Examples

The following example creates a minimal ImageQuest document, with a document type of "Invoice" and a page count of 5, associated with an unnamed TIF image, such as a temporary file from a scanning device. The document is queued for processing by the ImageQuest OCR service.

All example code is written in C#, using version 4 syntax and .NET 4.0.
using ( IIQAPI api = new ImageQuestService.IQAPIClient() )
{
   string token = api.SystemLogin("ImageQuest");
   byte[] data = File.ReadAllBytes(sourceFile);
   IQAttribute[] metadata = new[] 
   { 
       new IQDocumentAttribute { Name = "DocumentType", Value = "Invoice" },
       new IQDocumentAttribute { Name = "PageCount", Value = "5" },
       new IQDocumentAttribute { Name = "NeedsOCR", Value = "True" },
   };
   iqApi.CreateDocument(token, metaData,".TIF", data);
}
See Also