nfxConvertFileDirect

Performs image format conversion on TIFF-F or TIFF-S files.

Prototype

DWORD nfxConvertFileDirect ( CTAHD ctahd, char *input_file, char *output_file, NFX_CONVERT_PARMS *ptr_convert_parms, DWORD *ptr_converted_pages)

Argument

Description

ctahd

Context handle returned by ctaCreateContext.

input_file

Pointer to an existing file to be converted.

output_file

Pointer to a file to be created to receive the conversion output.

ptr_convert_parms

Pointer to an NFX_CONVERT_PARMS structure identifying the output format. The structure is defined as follows:

typedef struct 
{
  DWORD size;
  DWORD type;          /* NFX_TIFF_F or NFX_TIFF_S              */
  DWORD resolution;    /* NFX_RESOLUTION_HIGH,                  */
                       /* NFX_RESOLUTION_LOW,                   */
                       /* or NFX_RESOLUTION_SUPER_HIGH          */
  DWORD encoding;      /* NFX_ENCODE_1D, NFX_ENCODE_2D,         */
                       /* NFX_ENCODE_MMR, or NFX_ENCODE_TIFF_S  */
  DWORD pagewidth;     /* NFX_PAGE_WIDTH_A4, NFX_PAGE_WIDTH_B4  */
                       /* or NFX_PAGE_WIDTH_A3                  */
  DWORD badlineaction; /* NFX_BAD_LINE_ACTION_NONE,             */
                       /* NFX_BAD_LINE_ACTION_DROP,             */
                       /* NFX_BAD_LINE_ACTION_REPT, or          */
                       /* NFX_BAD_LINE_ACTION_TICK              */
} NFX_CONVERT_PARMS;

See NFX_CONVERT_PARMS for complete field descriptions.

ptr_converted_pages

Pointer to a location to receive a count of pages converted.

Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

Invalid function argument passed.

CTAERR_FILE_NOT_FOUND

The specified input file does not exist.

CTAERR_FILE_OPEN_FAILURE

Error opening file.

CTAERR_FILE_READ_FAILURE

Error reading file.

CTAERR_FILE_WRITE_FAILURE

Error writing to file.

CTAERR_INVALID_CTAHD

The specified context handle is invalid.

NFXERR_BAD_FILE_FORMAT

The specified input file is not in a valid format for conversion.

Events

None.

Details

nfxConvertFileDirect modifies the encoding, resolution, and page width of the input file to match the attributes specified in the NFX_CONVERT_PARMS structure. nfxConvertFileDirect also removes bad lines (as specified by the badlineaction parameter) from a TIFF-F or TIFF-S file. nfxConvertFileDirect can accept an input file that has different attributes on different pages and produce an output file that has the same attributes on all pages.

Specifying encoding with NFX_ENCODE_TIFF_S or NFX_TIFF_S overrides all parameters to the TIFF-S format. Encoding is 1D, resolution is LOW, and pagewidth is A4, regardless of any other values specified in this structure.

nfxConvertFileDirect operates only on TIFF-F or TIFF-S files. Output files are always in TIFF-F or TIFF-S format, and always have the same attributes on all pages.

This function is synchronous and consumes significant processor execution time. Pending events in this thread can be delayed by many seconds until this function completes. Errors occurring during the conversion process are indicated in the function return value. The number of pages converted successfully is given in ptr_converted_pages.

Note: Continue processing events during an active fax session. Make sure that file I/O intensive operations such as format conversion do not interfere with the handling of events and cause the fax session to time out. The application should process events within three seconds.

Refer to Performing offline image conversion for more information.

See also

nfxCheckTIFF