Bongsun Lee
Bongsun Lee

Reputation: 11

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                 
                 );

Upvotes: 1

Views: 689

Answers (1)

Tony Edgecombe
Tony Edgecombe

Reputation: 3915

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);

Upvotes: 1

Related Questions