//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e J o b H e a d e r // //--------------------------------------------------------------------// // // // Write stream initialisation sequences to output file. // // // //--------------------------------------------------------------------// private static void generateJobHeader(BinaryWriter prnWriter, Int32 paperSize, Int32 paperType, Int32 orientation) { PCLWriter.stdJobHeader(prnWriter, ""); PCLWriter.pageHeader(prnWriter, paperSize, paperType, orientation, PCLPlexModes.eSimplex); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e J o b H e a d e r // //--------------------------------------------------------------------// // // // Write stream initialisation sequences to output file. // // // //--------------------------------------------------------------------// private static void generateJobHeader(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt16 logXOffset) { PCLWriter.stdJobHeader(prnWriter, ""); if (formAsMacro) { generateOverlay(prnWriter, true, logXOffset, indxPaperSize, indxOrientation); } PCLWriter.pageHeader(prnWriter, indxPaperSize, indxPaperType, indxOrientation, PCLPlexModes.eSimplex); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e J o b H e a d e r // //--------------------------------------------------------------------// // // // Write stream initialisation sequences to output file. // // // //--------------------------------------------------------------------// private static void generateJobHeader(BinaryWriter prnWriter, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Int32 indxPlexMode, String pjlCommand, Boolean formAsMacro, Boolean customPaperSize, UInt16 paperWidth, UInt16 paperLength, UInt16 logXOffset, Single scaleText) { PCLWriter.stdJobHeader(prnWriter, pjlCommand); if (formAsMacro) { generateOverlay(prnWriter, true, paperWidth, paperLength, logXOffset, scaleText); } if (customPaperSize) { PCLWriter.pageHeaderCustom(prnWriter, indxPaperType, indxOrientation, indxPlexMode, paperWidth, paperLength); } else { PCLWriter.pageHeader(prnWriter, indxPaperSize, indxPaperType, indxOrientation, indxPlexMode); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 pageNo, Int32 pageCount, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxPaperTray, Int32 indxPlexMode, Int32 indxOrientFront, Int32 indxOrientRear, Int16 macroIdFront, Int16 macroIdRear, Single scaleFactor, Boolean formAsMacro) { Int16 posX, posY, posYInc; Int32 pitchMain = (Int32)(6 / scaleFactor); Boolean simplex = PCLPlexModes.isSimplex(indxPlexMode); PCLWriter.pageHeader(prnWriter, indxPaperSize, indxPaperType, indxOrientFront, indxPlexMode); if (indxPaperTray != -1) { PCLWriter.paperSource(prnWriter, (Int16)indxPaperTray); } if (!simplex) { PCLWriter.pageFace(prnWriter, true); } if (formAsMacro) { PCLWriter.macroControl(prnWriter, macroIdFront, PCLWriter.eMacroControl.Call); } else { generateOverlayFront(prnWriter, false, _noForm, scaleFactor); } //----------------------------------------------------------------// posYInc = (Int16)(scaleFactor * _posYIncMain); posX = (Int16)((scaleFactor * _posXValue) - _logPageOffset); posY = (Int16)((scaleFactor * _posYDesc)); PCLWriter.font(prnWriter, true, "19U", "s0p" + pitchMain + "h0s3b4099T"); if (simplex) { PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() + " of " + pageCount.ToString()); } else { PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() + " of " + pageCount.ToString()); } //----------------------------------------------------------------// posY += posYInc; if (indxPaperSize >= PCLPaperSizes.getCount()) { PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***"); } else { PCLWriter.text(prnWriter, posX, posY, 0, PCLPaperSizes.getName(indxPaperSize)); } //----------------------------------------------------------------// posY += posYInc; if (indxPaperType >= PCLPaperTypes.getCount()) { PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***"); } else if (PCLPaperTypes.getType(indxPaperType) == PCLPaperTypes.eEntryType.NotSet) { PCLWriter.text(prnWriter, posX, posY, 0, "<not set>"); } else { PCLWriter.text(prnWriter, posX, posY, 0, PCLPaperTypes.getName(indxPaperType)); } //----------------------------------------------------------------// posY += posYInc; if (indxPlexMode >= PCLPlexModes.getCount()) { PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***"); } else { PCLWriter.text(prnWriter, posX, posY, 0, PCLPlexModes.getName(indxPlexMode)); } //----------------------------------------------------------------// posY += posYInc; if (indxOrientFront >= PCLOrientations.getCount()) { PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***"); } else { PCLWriter.text(prnWriter, posX, posY, 0, PCLOrientations.getName(indxOrientFront)); } //----------------------------------------------------------------// posY += posYInc; if (indxPaperTray == PCLTrayDatas.getIdNotSetPCL()) { PCLWriter.text(prnWriter, posX, posY, 0, "<not set>"); } else if (indxPaperTray == _trayIdAutoSelectPCL) { PCLWriter.text(prnWriter, posX, posY, 0, indxPaperTray.ToString() + " (auto-select)"); } else { PCLWriter.text(prnWriter, posX, posY, 0, indxPaperTray.ToString()); } //----------------------------------------------------------------// // // // Rear face (if not simplex) // // // //----------------------------------------------------------------// if (!simplex) { if (indxOrientRear != indxOrientFront) { PCLWriter.pageOrientation( prnWriter, PCLOrientations.getIdPCL(indxOrientRear).ToString()); } PCLWriter.pageFace(prnWriter, false); if (formAsMacro) { PCLWriter.macroControl(prnWriter, macroIdRear, PCLWriter.eMacroControl.Call); } else { generateOverlayRear(prnWriter, false, _noForm, scaleFactor); } //----------------------------------------------------------------// posX = (Int16)((scaleFactor * _posXValue) - _logPageOffset); posY = (Int16)(scaleFactor * _posYDesc); PCLWriter.font(prnWriter, true, "19U", "s0p" + pitchMain + "h0s3b4099T"); PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() + " (rear) of " + pageCount.ToString()); //----------------------------------------------------------------// posY += (Int16)(posYInc * 4); if (indxOrientRear >= PCLOrientations.getCount()) { PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***"); } else { PCLWriter.text(prnWriter, posX, posY, 0, PCLOrientations.getName(indxOrientRear)); } } PCLWriter.formFeed(prnWriter); }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e P a g e // //--------------------------------------------------------------------// // // // Write individual test data page sequences to output file. // // // //--------------------------------------------------------------------// private static void generatePage(BinaryWriter prnWriter, Int32 pageNo, Int32 pageCount, Int32 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Int32 indxOrientRear, Int32 indxPlexMode, Boolean flagFrontFace, Boolean flagSimplexJob, Boolean flagMainForm, Boolean flagRearForm, Boolean flagMainOnPrnDisk, Boolean flagRearOnPrnDisk, Boolean flagRearBPlate, Boolean flagPrintDescText, String formFileMain, String formFileRear, eMacroMethod indxMethod, Int32 macroIdMain, Int32 macroIdRear) { const Int16 incPosY = 150; Boolean altOrient; Boolean pageUsesForm; Boolean firstPage; Int16 posX, posY; Int32 macroId; Int32 indxOrient; altOrient = (indxOrientation != indxOrientRear); firstPage = (pageNo == 1); if (flagFrontFace) { indxOrient = indxOrientation; pageUsesForm = flagMainForm; macroId = macroIdMain; } else { indxOrient = indxOrientRear; if (flagRearForm) { pageUsesForm = flagRearForm; macroId = macroIdRear; } else { pageUsesForm = flagMainForm; macroId = macroIdMain; } } if (firstPage) { //------------------------------------------------------------// // // // Generate first (or only) page header. // // // //------------------------------------------------------------// PCLWriter.pageHeader(prnWriter, indxPaperSize, indxPaperType, indxOrientation, indxPlexMode); if (indxMethod == eMacroMethod.Overlay) { PCLWriter.macroControl(prnWriter, (Int16)macroIdMain, PCLWriter.eMacroControl.Overlay); } } else { //----------------------------------------------------------------// // // // Not first page: // // - for simplex jobs: // // - write 'form feed' sequence. // // - for duplex jobs: // // - write 'page side' sequence. // // - if rear face, and alternate orientations specified, // // write 'set orientation' sequence. // // // //----------------------------------------------------------------// if (flagSimplexJob) { PCLWriter.formFeed(prnWriter); } else { PCLWriter.pageFace(prnWriter, flagFrontFace); if (altOrient) { PCLWriter.pageOrientation( prnWriter, PCLOrientations.getIdPCL(indxOrient).ToString()); } } } //----------------------------------------------------------------// // // // Write any required 'begin page' macro 'call' or 'execute' // // sequence. // // // //----------------------------------------------------------------// if (pageUsesForm) { if (indxMethod == eMacroMethod.CallBegin) { PCLWriter.macroControl(prnWriter, (Int16)macroId, PCLWriter.eMacroControl.Call); } else if (indxMethod == eMacroMethod.ExecuteBegin) { PCLWriter.macroControl(prnWriter, (Int16)macroId, PCLWriter.eMacroControl.Execute); } } //----------------------------------------------------------------// // // // Write descriptive text headers. // // // //----------------------------------------------------------------// if (flagPrintDescText) { //------------------------------------------------------------// // // // Write headers. // // // //------------------------------------------------------------// PCLWriter.font(prnWriter, true, "19U", "s0p12h0s0b4099T"); posX = 600 - _logPageOffset; posY = 1350; PCLWriter.text(prnWriter, posX, posY, 0, "Page:"); if (firstPage) { posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Paper size:"); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Paper type:"); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Plex mode:"); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Method:"); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Orientation:"); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, "Rear orientation:"); posY += incPosY; if (flagMainOnPrnDisk) { PCLWriter.text(prnWriter, posX, posY, 0, "Main form printer file:"); } else { PCLWriter.text(prnWriter, posX, posY, 0, "Main form download file:"); } posY += incPosY; if (flagRearOnPrnDisk) { PCLWriter.text(prnWriter, posX, posY, 0, "Rear form printer file:"); } else { PCLWriter.text(prnWriter, posX, posY, 0, "Rear form download file:"); } posY += incPosY; if ((flagRearForm) && (flagRearBPlate)) { PCLWriter.text(prnWriter, posX, posY, 0, "Rear Form is boilerplate"); } } //------------------------------------------------------------// // // // Write variable data. // // // //------------------------------------------------------------// PCLWriter.font(prnWriter, true, "19U", "s0p12h0s3b4099T"); posX = 1920 - _logPageOffset; posY = 1350; PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() + " of " + pageCount.ToString()); if (firstPage) { String textOrientRear; posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, PCLPaperSizes.getName(indxPaperSize)); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, PCLPaperTypes.getName(indxPaperType)); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, PCLPlexModes.getName(indxPlexMode)); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, macroMethodNames[(Int32)indxMethod]); posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, PCLOrientations.getName(indxOrientation)); if (flagSimplexJob) { textOrientRear = "<not applicable>"; } else if (altOrient) { textOrientRear = PCLOrientations.getName(indxOrientRear); } else { textOrientRear = "<not set>"; } posY += incPosY; PCLWriter.text(prnWriter, posX, posY, 0, textOrientRear); posY += incPosY; if (flagMainForm) { const Int32 maxLen = 51; const Int32 halfLen = (maxLen - 5) / 2; Int32 len = formFileMain.Length; if (len < maxLen) { PCLWriter.text(prnWriter, posX, posY, 0, formFileMain); } else { PCLWriter.text(prnWriter, posX, posY, 0, formFileMain.Substring(0, halfLen) + " ... " + formFileMain.Substring(len - halfLen, halfLen)); } } posY += incPosY; if (flagRearForm) { const Int32 maxLen = 51; const Int32 halfLen = (maxLen - 5) / 2; Int32 len = formFileRear.Length; if (len < maxLen) { PCLWriter.text(prnWriter, posX, posY, 0, formFileRear); } else { PCLWriter.text(prnWriter, posX, posY, 0, formFileRear.Substring(0, halfLen) + " ... " + formFileRear.Substring(len - halfLen, halfLen)); } } } } //----------------------------------------------------------------// // // // Write any required 'end of page' macro 'call' or 'execute' // // sequences. // // // //----------------------------------------------------------------// if (pageUsesForm) { if (indxMethod == eMacroMethod.CallEnd) { PCLWriter.macroControl(prnWriter, (Int16)macroId, PCLWriter.eMacroControl.Call); } else if (indxMethod == eMacroMethod.ExecuteEnd) { PCLWriter.macroControl(prnWriter, (Int16)macroId, PCLWriter.eMacroControl.Execute); } } //------------------------------------------------------------// // // // Generate rear boilerplate side if necessary. // // // //------------------------------------------------------------// if ((flagRearForm) && (flagRearBPlate)) { PCLWriter.pageFace(prnWriter, false); if (altOrient) { PCLWriter.pageOrientation( prnWriter, PCLOrientations.getIdPCL(indxOrientRear).ToString()); } if ((indxMethod == eMacroMethod.CallBegin) || (indxMethod == eMacroMethod.CallEnd)) { PCLWriter.macroControl(prnWriter, (Int16)macroIdRear, PCLWriter.eMacroControl.Call); } else if ((indxMethod == eMacroMethod.ExecuteBegin) || (indxMethod == eMacroMethod.ExecuteEnd)) { PCLWriter.macroControl(prnWriter, (Int16)macroIdRear, PCLWriter.eMacroControl.Execute); } } }