开发者

Problem - Sending postscript data to printer using ExtEscape

开发者 https://www.devze.com 2022-12-13 08:26 出处:网络
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

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开发者_Go百科            
                 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);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号