VpeDevSendData

<< Click to Display Table of Contents >>

Navigation:  Device Control Properties >

VpeDevSendData

Previous pageReturn to chapter overviewNext page

[Windows platform only; not supported by the Community Edition]

This method enables your application to send printer dependent Escape-Sequences (control sequences and binary data) directly to the printer. Because the data you send with this method is strictly printer dependent, you must know to what printer model you are printing.

With this method it is possible, to select for example an output paper bin by code (or whatever other functionality is provided by the connected printer).

int VpeDevSendData(

VpeHandle hDoc,

LPCSTR data,

long size

)

VpeHandle hDoc

Document Handle

LPCSTR data

the string with the data

long size

the number of bytes (characters) in the parameter string "data"

Returns:

Value

Description

True

success

False

failure

Remarks:

In case of an error, LastError is set to VERR_COMMON. An error may occur if the device does not support sending binary data.

 

You may call this function only while processing the event VPE_PRINT_DEVDATA.

If you call VpeDevSendData() while not processing this event, the method does nothing.

Example:

In C / C++ (while processing the VPE_PRINT_DEVDATA event)

strcpy(s, "\033&l3O"); // PCL command to change Paper orientation to Reverse Landscape

VpeDevSendData(hdoc, s, 5);

return PRINT_ACTION_CHANGE;

In our example, we send the "Reverse Landscape" PCL command to the printer, which is 5 bytes in size ("\033&130", where "\033" is one character octal coded = 27 decimal).

The characters in the string are: "&" + the letter "l" + "3" + the letter "O"