//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 paperWidth, UInt16 paperLength, UInt16 logXOffset) { Int16 rulerWidth; Int16 rulerHeight; Int16 rulerCellsX; Int16 rulerCellsY; Int16 posX, posY; Int16 lineInc, ptSize; Int16 stroke = 1; //----------------------------------------------------------------// rulerCellsX = (Int16)((paperWidth / _unitsPerInch) + 1); rulerCellsY = (Int16)((paperLength / _unitsPerInch) + 1); rulerWidth = (Int16)(rulerCellsX * _unitsPerInch); rulerHeight = (Int16)(rulerCellsY * _unitsPerInch); //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Horizontal ruler. // // // //----------------------------------------------------------------// posX = 0; posY = _rulerHOriginY; PCLWriter.lineHorizontal(prnWriter, posX, posY, rulerWidth, stroke); posY -= (_rulerDiv / 2); for (Int32 i = 0; i < rulerCellsX; i++) { PCLWriter.lineVertical(prnWriter, posX, posY, _rulerDiv * 2, stroke); posX += _rulerDiv; for (Int32 j = 1; j < _rulerDivPerCell; j++) { PCLWriter.lineVertical(prnWriter, posX, posY, _rulerDiv, stroke); posX += _rulerDiv; } } //----------------------------------------------------------------// // // // Vertical ruler. // // // //----------------------------------------------------------------// posX = _rulerVOriginX; posY = 0; PCLWriter.lineVertical(prnWriter, posX, posY, rulerHeight, stroke); posX -= (_rulerDiv / 2); for (Int32 i = 0; i < rulerCellsY; i++) { PCLWriter.lineHorizontal(prnWriter, posX, posY, _rulerDiv * 2, stroke); posY += _rulerDiv; for (Int32 j = 1; j < _rulerDivPerCell; j++) { PCLWriter.lineHorizontal(prnWriter, posX, posY, _rulerDiv, stroke); posY += _rulerDiv; } } //----------------------------------------------------------------// // // // Left logical page margin - vertical line. // // // //----------------------------------------------------------------// PCLWriter.lineVertical(prnWriter, 0, 0, rulerHeight, stroke); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// ptSize = 10; lineInc = (_rulerDiv * 2); PCLWriter.font(prnWriter, true, "19U", "s1p" + ptSize + "v0s0b16602T"); posX = (Int16)(_posXDesc - logXOffset); posY = _posYDesc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper size:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Orientation:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper width:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper length:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Logical page left offset:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Logical page top offset:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Logical page width:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Logical page height:"); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }
//--------------------------------------------------------------------// // M e t h o d // // g e n e r a t e O v e r l a y // //--------------------------------------------------------------------// // // // Write background data sequences to output file. // // Optionally top and tail these with macro (user-defined stream) // // definition sequences. // // // //--------------------------------------------------------------------// private static void generateOverlay(BinaryWriter prnWriter, Boolean formAsMacro, UInt16 paperWidth, UInt16 paperLength, UInt16 logXOffset, Single scaleText) { Int16 rulerWidth; Int16 rulerHeight; Int16 rulerCellsX; Int16 rulerCellsY; Int16 posX, posY; Int16 lineInc, ptSize; Int16 stroke = 1; //----------------------------------------------------------------// rulerCellsX = (Int16)((paperWidth / _sessionUPI) - 1); rulerCellsY = (Int16)((paperLength / _sessionUPI) - 1); rulerWidth = (Int16)(rulerCellsX * _sessionUPI); rulerHeight = (Int16)(rulerCellsY * _sessionUPI); //----------------------------------------------------------------// // // // Header // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.StartDef); } //----------------------------------------------------------------// // // // Horizontal ruler. // // // //----------------------------------------------------------------// posX = (Int16)(_rulerOriginX - logXOffset); posY = _rulerOriginY; PCLWriter.lineHorizontal(prnWriter, posX, posY, rulerWidth, stroke); posX += _rulerCell; for (Int32 i = 0; i < rulerCellsX; i++) { PCLWriter.lineVertical(prnWriter, posX, posY, _rulerDiv, stroke); posX += _rulerCell; } //----------------------------------------------------------------// // // // Vertical ruler. // // // //----------------------------------------------------------------// posX = (Int16)(_rulerOriginX - logXOffset); posY = _rulerOriginY; PCLWriter.lineVertical(prnWriter, posX, posY, rulerHeight, stroke); posY += _rulerCell; for (Int32 i = 0; i < rulerCellsY; i++) { PCLWriter.lineHorizontal(prnWriter, posX, posY, _rulerDiv, stroke); posY += _rulerCell; } //----------------------------------------------------------------// // // // Left logical page margin - vertical line. // // // //----------------------------------------------------------------// PCLWriter.lineVertical(prnWriter, 0, _rulerOriginY, rulerHeight, stroke); //----------------------------------------------------------------// // // // Sample marker box. // // // //----------------------------------------------------------------// lineInc = (Int16)((_sessionUPI * scaleText) / 8); posX = (Int16)((_rulerCell * 5.5 * scaleText) - logXOffset); posY = (Int16)(_posYDesc - lineInc); generateSquare(prnWriter, posX, posY, true); //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// ptSize = (Int16)(15 * scaleText); PCLWriter.font(prnWriter, true, "19U", "s1p" + ptSize + "v0s0b16602T"); posX = (Int16)(_posXHddr - logXOffset); posY = _posYHddr; PCLWriter.text(prnWriter, posX, posY, 0, "PCL print area sample"); ptSize = (Int16)(10 * scaleText); PCLWriter.font(prnWriter, true, "19U", "s1p" + ptSize + "v0s0b16602T"); posX = (Int16)(_posXDesc - logXOffset); posY = _posYDesc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper size:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper type:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Orientation:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Plex mode:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper width:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Paper length:"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "PJL option:"); //----------------------------------------------------------------// posY = (Int16)(_posYDesc + (_rulerCell * scaleText)); PCLWriter.text(prnWriter, posX, posY, 0, "Black squares of side 3 units, each containing a" + " central white square of side one"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "unit, and some directional markers, as per the" + " half-size sample above,"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "demonstrate how objects are clipped by the" + " boundaries of the printable area."); posY += lineInc; posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "The four corner squares are (theoretically) positioned" + " in the corners of the"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "physical sheet, except that the left edges of the top" + " and bottom left-hand squares"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "are constrained to be positioned at the left margin" + " of the PCL logical page,"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "which is inset from the sheet edge, and marked here" + " with a vertical line."); posY += lineInc; posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "The middle left-hand square is positioned relative" + " to the bottom and right logical"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "page margins, and rotated 180 degrees."); posY += lineInc; posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "Fixed pitch (10 cpi) text characters are also clipped" + " by the boundaries of the"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "printable area; one set is shown relative to the" + " left logical page margin, and"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "another set (rotated 180 degrees) is shown" + " relative to the right margin."); posY += lineInc; posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "PJL options may move the logical page and/or" + " unprintable area margins relative"); posY += lineInc; PCLWriter.text(prnWriter, posX, posY, 0, "to the physical sheet."); //----------------------------------------------------------------// // // // Overlay end. // // // //----------------------------------------------------------------// if (formAsMacro) { PCLWriter.macroControl(prnWriter, 0, PCLWriter.eMacroControl.StopDef); } }