Header

Document handling


Detailed Description

Functions for recognizing, reading and handling documents.


Modules

 Examples
 Document handling example

Functions

static int pr_getocr (gxHANDLE handle, int page, int light, int type, gxVARIANT *doc, gxVARIANT ocrparams)
 Reads the OCR from an unknown document.
static int pr_getmrz (gxHANDLE handle, int page, int light, int type, gxVARIANT *doc)
 Reads the MRZ lines from the document.
static int pr_getbarcode (gxHANDLE handle, int page, int light, int type, int bctype, int index, gxVARIANT *doc)
 Reads the barcodes from an unknown document.
static int pr_getdocumentrect (gxHANDLE handle, int page, int light, int type, gxVARIANT *doc)
 Returns the quad of the document.
static int pr_recognize (gxHANDLE handle, int page, gxVARIANT *doc)
 Reads all of the known data from a known document type.
static int pr_analyze (gxHANDLE handle, gxVARIANT page, int tasklen, int *task, gxVARIANT *doc)
 Reads the data specified in task array from the document.
static int pr_analyzed (gxHANDLE handle, gxu8 *buffer, int buflen, gxVARIANT *doc, const wchar_t *comment)
 Separates and processes the data fields in a given binary data array.
static int pr_resolvemrztext (gxHANDLE handle, const wchar_t **lines, int nlines, gxVARIANT *doc)
 Separates the data fields in the given MRZ text (Unicode version).
static int pr_resolvemrztexta (gxHANDLE handle, const char **lines, int nlines, gxVARIANT *doc)
 Separates the data fields in the given MRZ text (ASCII version).
static int pr_getdocumentstatus (gxHANDLE handle, gxVARIANT doc, int *code, int *status)
 Document structure analyser function, it gives back the main document properties.
static int pr_getfieldfromdoc (gxHANDLE handle, gxVARIANT doc, int field_code, int index, gxVARIANT *field)
 Document structure analyser function and gives back the properties of a field.
static int pr_getfieldfromdocw (gxHANDLE handle, gxVARIANT doc, int field_code, wchar_t *text, int *stext, int *status, gxPG4 *frame)
 Document structure analyser function and gives back the properties of a field (Unicode version).
static int pr_getfieldfromdoca (gxHANDLE handle, gxVARIANT doc, int field_code, char *text, int *stext, int *status, gxPG4 *frame)
 Document structure analyser function and gives back the properties of a field (ASCII version).
static int pr_getfieldfromdocb (gxHANDLE handle, gxVARIANT doc, int field_code, void *data, int *sdata, int *status, gxPG4 *frame)
 Document structure analyser function and gives back the properties of a field (Binary version).
static int pr_getfieldimage (gxHANDLE handle, gxVARIANT doc, int field_code, int index, gxVARIANT *img)
 Returns a variant image from the document structure.
static int pr_getgximagefromdoc (gxHANDLE handle, gxVARIANT doc, int field_code, gxIMAGE **img)
 Returns a gxIMAGE from the document structure.
static int pr_getpropfromdoc (gxHANDLE handle, gxVARIANT doc, int field_code, int prop_code, void *data, int *sdata, int *data_type)
 Returns a property field from the document structure.
static int pr_compareface (gxHANDLE handle, int page, int face_no, gxVARIANT *doc)
 Compares a captured face photo with one that is stored in rfid chip.
static int pr_savedocument (gxHANDLE handle, gxVARIANT pdoc, const wchar_t *filename, int filetype)
 Saves a document to a mass storage device in the specific file format (Unicode version).
static int pr_savedocumenta (gxHANDLE handle, gxVARIANT pdoc, const char *filename, int filetype)
 Saves a document to a mass storage device in the specific file format (ASCII version).
static int pr_savedocumenttomem (gxHANDLE handle, gxVARIANT pdoc, gxu8 **buffer, int *buflen, int filetype)
 Saves a document to memory in the specific file format.
static int pr_getdocumentroot (gxHANDLE handle, gxVARIANT *pdoc)
 Returns the root document of the PR system.
static int pr_decodelatentimage (gxHANDLE handle, int page, int light, int type, const wchar_t *decpar, gxVARIANT *image)
 Decodes a latent image from a stored image.
static int pr_resolvemagstripe (gxHANDLE handle, const wchar_t **tracks, int ntracks, gxVARIANT *doc)
 Separates the data fields in the given magnetic stripe text (Unicode version).
static int pr_resolvemagstripea (gxHANDLE handle, const char **tracks, int ntracks, gxVARIANT *doc)
 Separates the data fields in the given magnetic stripe text (ASCII version).
static int pr_mergedocument (gxHANDLE handle, gxVARIANT doc1, gxVARIANT doc2, gxVARIANT *pdoc)
 Merges two documents.


Function Documentation

static int pr_getocr ( gxHANDLE  handle,
int  page,
int  light,
int  type,
gxVARIANT doc,
gxVARIANT  ocrparams 
) [static]

Reads the OCR from an unknown document.

The returned document structure will contain just the recognized rows without additional details, even when the type of the document is known.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
light The light settings. The possible values are defined in the PR_LIGHT enumeration.
type The type of the image. It must be PR_IT_ORIGINAL.
doc Buffer for the result document structure.
ocrparams Ocr parameters.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_getmrz ( gxHANDLE  handle,
int  page,
int  light,
int  type,
gxVARIANT doc 
) [static]

Reads the MRZ lines from the document.

It is for compatibility reasons with the old system. The pr_recognize() function should be called instead, except when the speed is important.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
light The light settings. The possible values are defined in the PR_LIGHT enumeration.
type The type of the image. It must be PR_IT_ORIGINAL.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_getbarcode ( gxHANDLE  handle,
int  page,
int  light,
int  type,
int  bctype,
int  index,
gxVARIANT doc 
) [static]

Reads the barcodes from an unknown document.

The returned document structure will contain just the barcode data without additional information, even when the type of the document is known.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
light The light settings. The possible values are defined in the PR_LIGHT enumeration.
type The type of the image. It must be PR_IT_ORIGINAL.
bctype The needed barcode type. The possible values are defined in PR_BCTYPE enumeration. If this parameter is NULL any type of barcode can be returned.
index The ordinal number of the barcode. If more barcodes found.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_getdocumentrect ( gxHANDLE  handle,
int  page,
int  light,
int  type,
gxVARIANT doc 
) [static]

Returns the quad of the document.

It is retained for compatibility reasons with the old system. This quad was used to produce the document view.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
light The light settings. The possible values are defined in the PR_LIGHT enumeration.
type The type of the image. It must be PR_IT_ORIGINAL.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_recognize ( gxHANDLE  handle,
int  page,
gxVARIANT doc 
) [static]

Reads all of the known data from a known document type.

The function finds the quad of the document, recognizes it's type and reads MRZ, VIZ and BC fields from it.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_analyze ( gxHANDLE  handle,
gxVARIANT  page,
int  tasklen,
int *  task,
gxVARIANT doc 
) [static]

Reads the data specified in task array from the document.

Parameters:
handle Handle of the prapi module.
page List of images to read from.
tasklen Size of the task array.
task Int array specifies the reading task.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_analyzed ( gxHANDLE  handle,
gxu8 *  buffer,
int  buflen,
gxVARIANT doc,
const wchar_t *  comment 
) [static]

Separates and processes the data fields in a given binary data array.

Parameters:
handle Handle of the prapi module.
buffer Input buffer.
buflen Number of bytes in the buffer.
doc Buffer for the result document structure.
comment Identifier of the data source.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_resolvemrztext ( gxHANDLE  handle,
const wchar_t **  lines,
int  nlines,
gxVARIANT doc 
) [static]

Separates the data fields in the given MRZ text (Unicode version).

It can be used to separate user defined MRZ in appropriate document fields.

Parameters:
handle Handle of the prapi module.
lines Array of row strings.
nlines Number of rows.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_resolvemrztexta ( gxHANDLE  handle,
const char **  lines,
int  nlines,
gxVARIANT doc 
) [static]

Separates the data fields in the given MRZ text (ASCII version).

It can be used to separate user defined MRZ in appropriate document fields.

Parameters:
handle Handle of the prapi module.
lines Array of row strings.
nlines Number of rows.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_getdocumentstatus ( gxHANDLE  handle,
gxVARIANT  doc,
int *  code,
int *  status 
) [static]

Document structure analyser function, it gives back the main document properties.

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
code Buffer for the type of the document. The possible types are defined in the PR_DOCUMENT enumeration.
status Buffer for the worst field error code in the document. The error codes are defined in the PR_CHKERR enumeration.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_getfieldfromdoc ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
int  index,
gxVARIANT field 
) [static]

Document structure analyser function and gives back the properties of a field.

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
index The index if more than one fields exist with the same id.
field The field structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

Referenced by pr_getfieldfromdoca(), pr_getfieldfromdocb(), pr_getfieldfromdocw(), and pr_getpropfromdoc().

static int pr_getfieldfromdocw ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
wchar_t *  text,
int *  stext,
int *  status,
gxPG4 frame 
) [static]

Document structure analyser function and gives back the properties of a field (Unicode version).

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
text Buffer for the string of the field.
stext This buffer must contain the size of the string buffer, and returns the size of the string.
status Buffer for the error code of the field. The error codes are defined in the PR_CHKERR enumeration.
frame Buffer for the quad of the field.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_convertvariantchild(), gx_disposevariant(), GX_ENOENT, gx_geterrorcode(), gx_poperror(), gx_pusherror(), GX_VARIANT_INT, GX_VARIANT_INTARRAY, GX_VARIANT_UNICODE, pr_getfieldfromdoc(), PRV_CHECKSUM, PRV_FIELDVALUE, and PRV_WINDOWFRAME.

static int pr_getfieldfromdoca ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
char *  text,
int *  stext,
int *  status,
gxPG4 frame 
) [static]

Document structure analyser function and gives back the properties of a field (ASCII version).

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
text Buffer for the string of the field.
stext This buffer must contain the size of the string buffer, and returns the size of the string.
status Buffer for the error code of the field. The error codes are defined in the PR_CHKERR enumeration.
frame Buffer for the quad of the field.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_convertvariantchild(), gx_disposevariant(), GX_ENOENT, gx_geterrorcode(), gx_poperror(), gx_pusherror(), GX_VARIANT_ASCII, GX_VARIANT_INT, GX_VARIANT_INTARRAY, pr_getfieldfromdoc(), PRV_CHECKSUM, PRV_FIELDVALUE, and PRV_WINDOWFRAME.

static int pr_getfieldfromdocb ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
void *  data,
int *  sdata,
int *  status,
gxPG4 frame 
) [static]

Document structure analyser function and gives back the properties of a field (Binary version).

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
data Buffer for the data of the field.
sdata This buffer must contain the size of the data buffer, and returns the size of the data.
status Buffer for the error code of the field. The error codes are defined in the PR_CHKERR enumeration.
frame Buffer for the quad of the field.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_convertvariantchild(), gx_disposevariant(), GX_ENOENT, gx_geterrorcode(), gx_poperror(), gx_pusherror(), GX_VARIANT_BINARY, GX_VARIANT_INT, GX_VARIANT_INTARRAY, pr_getfieldfromdoc(), PRV_CHECKSUM, PRV_FIELDVALUE, and PRV_WINDOWFRAME.

static int pr_getfieldimage ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
int  index,
gxVARIANT img 
) [static]

Returns a variant image from the document structure.

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
index The index if more than one fields exist with the same id.
img Pointer to the returned image.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

Referenced by pr_getgximagefromdoc().

static int pr_getgximagefromdoc ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
gxIMAGE **  img 
) [static]

Returns a gxIMAGE from the document structure.

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
img Pointer to the returned image.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_disposevariant(), gx_imagefromvariant(), gx_poperror(), gx_pusherror(), and pr_getfieldimage().

static int pr_getpropfromdoc ( gxHANDLE  handle,
gxVARIANT  doc,
int  field_code,
int  prop_code,
void *  data,
int *  sdata,
int *  data_type 
) [static]

Returns a property field from the document structure.

Parameters:
handle Handle of the prapi module.
doc A document structure to analyse.
field_code The id of the needed field. The possible ids are defined in the PR_DOCFIELD enumeration.
prop_code The id of the needed property.
data Preallocated buffer for the data.
sdata Size of the preallocated buffer. On return it will contain the size of the returned data.
data_type On return it will contain the type of the returned data ( see prPropFieldItem::DATA_TYPES enumeration).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_convertvariantchild(), gx_poperror(), gx_pusherror(), gx_unrefvariant(), and pr_getfieldfromdoc().

static int pr_compareface ( gxHANDLE  handle,
int  page,
int  face_no,
gxVARIANT doc 
) [static]

Compares a captured face photo with one that is stored in rfid chip.

The application must call pr_resolverfiddata() function first.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
face_no The ordinal number of the face image in rfid data.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_savedocument ( gxHANDLE  handle,
gxVARIANT  pdoc,
const wchar_t *  filename,
int  filetype 
) [static]

Saves a document to a mass storage device in the specific file format (Unicode version).

Parameters:
handle Handle of the prapi module.
pdoc Pointer to the document.
filename Name of the file.
filetype Format of the file ( see PR_DOCFILEFORMATS ).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_savedocumenta ( gxHANDLE  handle,
gxVARIANT  pdoc,
const char *  filename,
int  filetype 
) [static]

Saves a document to a mass storage device in the specific file format (ASCII version).

Parameters:
handle Handle of the prapi module.
pdoc Pointer to the document.
filename Name of the file.
filetype Format of the file ( see PR_DOCFILEFORMATS ).
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_savedocumenttomem ( gxHANDLE  handle,
gxVARIANT  pdoc,
gxu8 **  buffer,
int *  buflen,
int  filetype 
) [static]

Saves a document to memory in the specific file format.

Parameters:
handle Handle of the prapi module.
pdoc Pointer to the document.
filetype Format of the file ( see PR_DOCFILEFORMATS ).
buffer Pointer to the memory area pointer that is large enough or NULL.
buflen Size of the memory area.

References gx_call().

static int pr_getdocumentroot ( gxHANDLE  handle,
gxVARIANT pdoc 
) [static]

Returns the root document of the PR system.

Parameters:
handle Handle of the prapi module.
pdoc Buffer for the root document.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_decodelatentimage ( gxHANDLE  handle,
int  page,
int  light,
int  type,
const wchar_t *  decpar,
gxVARIANT image 
) [static]

Decodes a latent image from a stored image.

Parameters:
handle Handle of the prapi module.
page The actual page of the image.
light The light settings. The possible values are defined in the PR_LIGHT enumeration.
type The type of the image. The possible values are defined in the PR_IMAGE_TYPE enumeration.
decpar Decoding parameter.
image The latent image.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_resolvemagstripe ( gxHANDLE  handle,
const wchar_t **  tracks,
int  ntracks,
gxVARIANT doc 
) [static]

Separates the data fields in the given magnetic stripe text (Unicode version).

Parameters:
handle Handle of the prapi module.
tracks Array of row strings.
ntracks Number of rows.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_resolvemagstripea ( gxHANDLE  handle,
const char **  tracks,
int  ntracks,
gxVARIANT doc 
) [static]

Separates the data fields in the given magnetic stripe text (ASCII version).

Parameters:
handle Handle of the prapi module.
tracks Array of row strings.
ntracks Number of rows.
doc Buffer for the result document structure.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call().

static int pr_mergedocument ( gxHANDLE  handle,
gxVARIANT  doc1,
gxVARIANT  doc2,
gxVARIANT pdoc 
) [static]

Merges two documents.

Parameters:
handle Handle of the prapi module.
doc1 One document.
doc2 Other document.
pdoc Buffer for the result document.
Returns:
On error false is returned and the error code/string in the GX system is set appropriately. ( see gx_geterror() )

References gx_call(), and gx_unrefvariant().


Generated  for Passport Reader
(c) ADAPTIVE RECOGNITION