English 中文(简体)
Problem - Sending postscript data to printer using ExtEscape
原标题:

I m trying to send postscript data to the printer using ExtEscape, but the printer didn t respond at all for the following code (1st ExtEscape returned true. 2nd ExtEscape also returned true, but no print came out). I appreciate any help.

escapeCode = POSTSCRIPT_PASSTHROUGH;
if (bReturn = ExtEscape( printerDC, QUERYESCSUPPORT, sizeof(int), 
                        (LPCSTR)&escapeCode, 0, NULL ) <= 0)
    return;


bReturn = ExtEscape(
                 hdcPrint,
                 escapeCode,  
                 sizeof(temp_out_ptr),     
                 temp_out_ptr,      // this contains postscript data            
                 0,                   
                 NULL                 
                 );
问题回答

Did you know using this method your data will be inserted into the middle of the drivers PostScript output.

If you want to spool a whole PostScript file directly to the printer bypassing the printer driver then you need something like this:

HANDLE ph = 0;
OpenPrinter(PrinterName, &ph, NULL);

DOC_INFO_1 di;
di.pDatatype = _T("RAW");
di.pDocName = DocumentName;
di.pOutputFile = NULL;

StartDocPrinter(ph, 1, (LPBYTE)(&di));
StartPagePrinter(ph);
DWORD dwWritten;
WritePrinter(ph, Data, LengthOfData, &dwWritten);
EndPagePrinter(ph);
EndDocPrinter(ph);
ClosePrinter(ph);




相关问题
How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

Do I need to escape this?

It might be a bit unusual, but I need to echo <?php. However, I think that PHP treats it as an actual <?php and starts executing code instead of treating it as a string. How can I escape <?...

热门标签