7.2 WFS_CMD_PTR_PRINT_FORM

Description This command is used to print a form by merging the supplied variable field data with the defined form and field data specified in the form. If no media is present, the device waits for the period of time specified by the dwTimeOut parameter in the WFSExecute call for media to be inserted.

Input Param LPWFSPTRPRINTFORM lpPrintForm;

typedef struct _wfs_ptr_print_form
{
LPSTR lpszFormName;
LPSTR lpszMediaName;
WORD wAlignment
WORD wOffsetX;
WORD wOffsetY;
WORD wResolution;
DWORD dwMediaControl;
LPSTR lpszFields;
} WFSPTRPRINTFORM, * LPWFSPTRPRINTFORM;

lpszFormName
Pointer to the null-terminated form name.

lpszMediaName
Pointer to the null-terminated media name.

wAlignment
Specifies the alignment of the form on the physical medium, as one of these values:

Value Meaning

WFS_PTR_ALNUSEFORMDEFN Use the alignment specified in the form definition.

WFS_PTR_ALNTOPLEFT Align form to top left of physical medium.

WFS_PTR_ALNTOPRIGHT Align form to top right of physical medium.

WFS_PTR_ALNBOTTOMLEFT Align form to bottom left of physical medium.

WFS_PTR_ALNBOTTOMRIGHT Align form to bottom right of physical medium.

wOffsetX
Specifies the horizontal offset of the form, relative to the horizontal alignment specified in wAlignment, in horizontal resolution units (from form definition); always a positive number (i.e., if aligned to the right side of the medium, means offset the form to the left). A value of WFS_PTR_OFFSETUSEFORMDEFN indicates that the xoffset value from the form definition should be used.

wOffsetY
Specifies the vertical offset of the form, relative to the vertical alignment specified in wAlignment, in vertical resolution units (from form definition); always a positive number
(i.e., if aligned to the bottom of the medium, means offset the form upward). A value of WFS_PTR_OFFSETUSEFORMDEFN indicates that the yoffset value from the form definition should be used.

wResolution
Specifies the resolution in which to print the form. Possible values are:

Value Meaning

WFS_PTR_RESLOW Print form with low resolution.

WFS_PTR_RESMED Print form with medium resolution.

WFS_PTR_RESHIGH Print form with high resolution.

WFS_PTR_RESVERYHIGH Print form with very high resolution.

dwMediaControl
Specifies the manner in which the media should be handled, as a combination of the flags described under WFS_CMD_PTR_CONTROL_MEDIA. A NULL value of this parameter means to do none of these actions, as when printing multiple forms on a single page.

lpszFields
Pointer to a series of "<FieldName>=<FieldValue>" strings, where each string is null-terminated with the final string terminating with two null characters. If the field is an index field, then the syntax of the string is instead "<FieldName>[<index>]=<FieldValue>", where <index> specifies the zero-based element of the index field.

Output Param None.

Error Codes The following additional error codes can be generated by this command:

Value Meaning

WFS_ERR_PTR_FORMNOTFOUND The specified form definition cannot be found.

WFS_ERR_PTR_FORMINVALID The specified form definition is invalid.

WFS_ERR_PTR_MEDIANOTFOUND The specified media definition cannot be found.

WFS_ERR_PTR_MEDIAINVALID The specified media definition is invalid.

WFS_ERR_PTR_MEDIASKEWED The media skew exceeded the limit in the form definition.

WFS_ERR_PTR_MEDIAOVERFLOW The form overflowed the media.

WFS_ERR_PTR_FIELDSPECFAILURE The syntax of the lpszFields member is invalid.

WFS_ERR_PTR_FIELDERROR An error occurred while processing a field, causing termination of the print request. An execute event WFS_EXEE_PTR_FIELDERROR is posted with the details.

Events The following additional events can be generated by this command:

Value Meaning

WFS_EXEE_PTR_NOMEDIA No media is present in the device.

WFS_EXEE_PTR_FIELDERROR A fatal error occured while processing a field.

WFS_EXEE_PTR_FIELDWARNING A non-fatal error occured while processing a field.

WFS_EXEE_PTR_MEDIAINSERTED Media has been inserted into the device.

Comments All error codes (except WFS_ERR_PTR_NOMEDIAPRESENT) and events listed under the WFS_CMD_PTR_CONTROL_MEDIA command description can also occur on this command.

An invalid field name is treated as a WFS_EXEE_PTR_FIELDWARNING event with WFS_PTR_FIELDNOTFOUND status. A WFS_EXEE_PTR_FIELDWARNING event is returned with WFS_PTR_FIELDOVERFLOW status if the data overflows the field, and the field definition OVERFLOW value is TRUNCATE, BESTFIT, OVERWRITE or WORDWRAP. Other field-related problems generate a field error return and event.