📄 ljcolor.cpp
字号:
#ifdef APDK_AUTODUPLEX if (thePrintContext->QueryDuplexMode ()) { strcpy (res, "@PJL SET DUPLEX=ON\015\012"); }#endif err = thePrinter->Send ((const BYTE *) res, strlen (res)); err = thePrinter->Send ((const BYTE*) EnterLanguage, sizeof (EnterLanguage)); ERRCHECK; err = thePrinter->Send ((const BYTE*) "PCL\015\012", 5); ERRCHECK; err = thePrinter->Send ((const BYTE*) Reset,sizeof (Reset)); ERRCHECK; sprintf (res, "\033&l%dH", thePrintContext->GetMediaSource ()); err = thePrinter->Send ((const BYTE *) res, strlen (res)); // Source ERRCHECK;// Media size, vertical spacing between lines and top margin memcpy (res, mediasize, mscount - 1); strcpy (res+mscount-1, "a8c0E"); err = thePrinter->Send ((const BYTE *) res, strlen (res)); ERRCHECK; sprintf (res, "\033*t%dR\033&u%dD", iRes, iRes); err=thePrinter->Send ((const BYTE*) res, strlen (res)); ERRCHECK; err = Margins (); ERRCHECK; CAPy = 0;// Default is single sided printing strcpy (res, "\033&l0S");#ifdef APDK_AUTODUPLEX DUPLEXMODE eDupMode = thePrintContext->QueryDuplexMode (); if (eDupMode != DUPLEXMODE_NONE) { sprintf (res, "\033&l%dS", (eDupMode == DUPLEXMODE_BOOK) ? 1 : 2); }#endif err = thePrinter->Send ((const BYTE *) res, strlen (res)); return err;}DRIVER_ERROR HeaderLJColor::Graphics (){ DRIVER_ERROR err; err = thePrinter->Send ((const BYTE*) grafStart, sizeof (grafStart)); ERRCHECK; if (((LJColor *) thePrinter)->bGrey_K) { err = thePrinter->Send ((const BYTE*) "\033*b2M", 5); ERRCHECK; } else { err = thePrinter->Send ((const BYTE*) "\033*b3M", 5); } return err;}DRIVER_ERROR HeaderLJColor::EndJob (){ char szBuff[128]; DRIVER_ERROR err = NO_ERROR; if (thePrinter->IOMode.bStatus) { sprintf (szBuff, "\033E\033%%-12345X@PJL EOJ NAME = \"%d\"\015\012@PJL RESET\015\012", (int) (thePrinter)); err = thePrinter->Send ((const BYTE *) szBuff, strlen (szBuff)); ERRCHECK; } strcpy (szBuff, "\033%-12345X"); err = thePrinter->Send ((const BYTE *) szBuff, strlen (szBuff)); return err;}DRIVER_ERROR HeaderLJColor::FormFeed (){ ((LJColor *)thePrinter)->bFGColorSet = FALSE; ((LJColor *)thePrinter)->m_iYPos = 0; return (thePrinter->Send ((const BYTE *) "\014", 1));}DRIVER_ERROR HeaderLJColor::SendCAPy (unsigned int iAbsY){ if (iAbsY == 0) { return thePrinter->Send ((const BYTE *) "\033*p0Y", 5); } return NO_ERROR;}DRIVER_ERROR LJColor::Encapsulate (const RASTERDATA* InputRaster, BOOL bLastPlane){ char szScratchStr[16]; DRIVER_ERROR err; m_iYPos++; if (bFGColorSet == FALSE) { Send ((const BYTE *) "\033*v7S", 5); bFGColorSet = TRUE; } sprintf (szScratchStr, "\033*b%uW", InputRaster->rastersize[COLORTYPE_COLOR]); err = Send ((const BYTE *) szScratchStr, strlen (szScratchStr)); if (err == NO_ERROR) { err = Send (InputRaster->rasterdata[COLORTYPE_COLOR], InputRaster->rastersize[COLORTYPE_COLOR]); }/* * Printers with low memory (64 MB or less) can run out of memory during decompressing * the image data and will abort the job. To prevent this, restart raster command. * Raghu */ if (!bGrey_K && m_iYResolution == 600 && m_iYPos % 1200 == 0) { SkipRasters (0); err = Send ((const BYTE *) "\033*rC\033*r1A\033*b3M", 14); } return err;}DRIVER_ERROR LJColor::SkipRasters (int nBlankRasters){ char szScratchStr[16]; DRIVER_ERROR err = NO_ERROR; if (m_pCompressor) { m_pCompressor->Flush (); } if (nBlankRasters > 0) { m_iYPos += nBlankRasters; sprintf (szScratchStr, "\033*p%dY", m_iYPos); err = Send ((const BYTE *) szScratchStr, strlen (szScratchStr)); } return err;}Header* LJColor::SelectHeader (PrintContext *pc){ m_iYResolution = pc->EffectiveResolutionY (); return new HeaderLJColor (this, pc);}DRIVER_ERROR LJColor::VerifyPenInfo(){ DRIVER_ERROR err = NO_ERROR; if(IOMode.bDevID == FALSE) { return err; } ePen = BOTH_PENS; return NO_ERROR;}DRIVER_ERROR LJColor::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter){// char* str;// DRIVER_ERROR err = SetPenInfo(str, QueryPrinter);// ERRCHECK; ePen = BOTH_PENS; return NO_ERROR;}Compressor* LJColor::CreateCompressor (unsigned int RasterSize){ bFGColorSet = FALSE; if (bGrey_K) return new Mode2 (pSS, RasterSize); m_pCompressor = new Mode3 (pSS, this, RasterSize); return m_pCompressor;}/* * Function name: ParseError * * Owner: Darrell Walker * * Purpose: To determine what error state the printer is in. * * Called by: Send() * * Parameters on entry: status_reg is the contents of the centronics * status register (at the time the error was * detected) * * Parameters on exit: unchanged * * Return Values: The proper DISPLAY_STATUS to reflect the printer * error state. * *//* We have to override the base class's (Printer) ParseError function due to the fact that the 8XX series returns a status byte of F8 when it's out of paper. Unfortunately, the 600 series returns F8 when they're turned off. The way things are structured in Printer::ParseError, we used to check only for DEVICE_IS_OOP. This would return true even if we were connected to a 600 series printer that was turned off, causing the Out of paper status message to be displayed. This change also reflects a corresponding change in IO_defs.h, where I split DEVICE_IS_OOP into DEVICE_IS_OOP, DJ400_IS_OOP, and DJ8XX_IS_OOP and we now check for DJ8XX_IS_OOP in the DJ8xx class's ParseError function below. 05/11/99 DGC.*/DISPLAY_STATUS LJColor::ParseError(BYTE status_reg){ DBG1("LJColor: parsing error info\n"); DRIVER_ERROR err = NO_ERROR; BYTE szReadBuff[256]; DWORD iReadCount = 256; DISPLAY_STATUS eStatus = (DISPLAY_STATUS) status_reg; char *tmpStr; int iErrorCode; if (!IOMode.bDevID) return eStatus; memset (szReadBuff, 0, 256); err = pSS->FromDevice (szReadBuff, &iReadCount); if (err == NO_ERROR && iReadCount == 0) return eStatus; if (strstr ((char *) szReadBuff, "JOB")) { if (!(tmpStr = strstr ((char *) szReadBuff, "NAME"))) return DISPLAY_PRINTING; tmpStr += 6; while (*tmpStr < '0' || *tmpStr > '9') tmpStr++; sscanf (tmpStr, "%d", &iErrorCode); if (iErrorCode != (int) (this)) return DISPLAY_PRINTING; } if (strstr ((char *) szReadBuff, "END")) { return DISPLAY_PRINTING_COMPLETE; } if (strstr ((char *) szReadBuff, "CANCEL")) return DISPLAY_PRINTING_CANCELED; if (!(tmpStr = strstr ((char *) szReadBuff, "CODE"))) return eStatus; tmpStr += 4; while (*tmpStr < '0' || *tmpStr > '9') tmpStr++; sscanf (tmpStr, "%d", &iErrorCode); if (iErrorCode < 32000) return DISPLAY_PRINTING; if (iErrorCode == 40010 || iErrorCode == 40020) return DISPLAY_NO_PENS; // Actually, out of toner if (iErrorCode == 40021) return DISPLAY_TOP_COVER_OPEN; if ((iErrorCode / 100) == 419) return DISPLAY_OUT_OF_PAPER; if ((iErrorCode / 1000) == 42 || iErrorCode == 40022) { DBG1("Paper Jammed\n"); return DISPLAY_PAPER_JAMMED; } if (iErrorCode > 40049 && iErrorCode < 41000) { DBG1("IO trap\n"); return DISPLAY_ERROR_TRAP; } if (iErrorCode == 40079) return DISPLAY_OFFLINE; return DISPLAY_ERROR_TRAP;}APDK_END_NAMESPACE#endif // defined APDK_LJCOLOR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -