//--------------------------------------------------------------------// // 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 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; String sampleText = "000000000000000"; Int16 posX, posY; Int32 indStd; Int16 ptSize; indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // Text. // // // //----------------------------------------------------------------// ptSize = 34; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameArial); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); //----------------------------------------------------------------// // Black // //----------------------------------------------------------------// posX = _posXData; posY = _posYData; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); prnWriter.Write(bufStd, 0, indStd); indStd = 0; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// // Shade 1 // //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.addAttrSint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternSelectID, _patternId_DarkGrey); PCLXLWriter.addAttrSint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); prnWriter.Write(bufStd, 0, indStd); indStd = 0; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// // Shade 2 // //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.addAttrSint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternSelectID, _patternId_LightGrey); PCLXLWriter.addAttrSint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); prnWriter.Write(bufStd, 0, indStd); indStd = 0; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// // White // //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 255); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); prnWriter.Write(bufStd, 0, indStd); indStd = 0; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // 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 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; String sampleText = "0123456789"; String sampleTextA = "01234"; String sampleTextB = "56789"; Int16 posX, posY; Int32 indStd; Int16 ptSize; indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // Descriptive text. // // // //----------------------------------------------------------------// ptSize = 18; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameCourier); posX = _posXData1; posY = _posYData; posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "Arial"); posY += _lineInc; prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // Embellished text. // // // //----------------------------------------------------------------// ptSize = 36; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameArial); posX = _posXData2; posY = _posYData; posY += _lineInc; PCLXLWriter.charAngle(prnWriter, false, 0); PCLXLWriter.charBold(prnWriter, false, 0); PCLXLWriter.charScale(prnWriter, false, (Single)1.0, (Single)1.0); PCLXLWriter.charShear(prnWriter, false, (Single)0.0, (Single)0.0); PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.charAngle(prnWriter, false, -30); PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, sampleText); //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.charShear(prnWriter, false, (Single)0.0, (Single)0.0); PCLXLWriter.charScale(prnWriter, false, (Single)2.0, (Single)1.0); PCLXLWriter.charAngle(prnWriter, false, -45); PCLXLWriter.textAngled(prnWriter, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, -45, sampleTextA); posX = (Int16)(posX + ((7 * _incInch) / 4)); posY += _lineInc; PCLXLWriter.charScale(prnWriter, false, (Single)1.0, (Single)2.0); PCLXLWriter.charAngle(prnWriter, false, 30); PCLXLWriter.textAngled(prnWriter, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, 30, sampleTextB); //----------------------------------------------------------------// prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // 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 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; Int16 posX, posY, rectX, rectY, rectHeight, rectWidth; Int32 indStd; Int16 ptSize; indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// // // // Pre-defined shading - not present in PCL XL. // // // //----------------------------------------------------------------// ptSize = 15; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameArial); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); posX = _posXData1; posY = _posYDesc1 + (_lineInc / 4); for (Int32 i = 0; i < _patternsCt; i++) { PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "n/a"); posY += _lineInc; } prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // User-defined shading. // // // //----------------------------------------------------------------// rectHeight = (Int16)(_lineInc / 2); rectWidth = _lineInc; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.PaletteDepth, (Byte)PCLXLAttrEnums.eVal.e8Bit); PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.PaletteData, 2, PCLXLWriter.monoPalette); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.TxMode, (Byte)PCLXLAttrEnums.eVal.eTransparent); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPatternTxMode); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // User-defined 300 dpi shading. // // // //----------------------------------------------------------------// rectX = _posXData2; rectY = _posYData; patternDefineDpi300(prnWriter, _patternBase_300); for (Int32 i = 0; i < _patternsCt; i++) { PCLXLWriter.addAttrSint16( ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternSelectID, (Int16)(_patternBase_300 + _patternIds[i])); PCLXLWriter.addAttrSint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); rectY += _lineInc; } prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // User-defined 600 dpi shading. // // // //----------------------------------------------------------------// rectX = _posXData3; rectY = _posYData; patternDefineDpi600(prnWriter, _patternBase_600); for (Int32 i = 0; i < _patternsCt; i++) { PCLXLWriter.addAttrSint16( ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternSelectID, (Int16)(_patternBase_600 + _patternIds[i])); PCLXLWriter.addAttrSint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PatternOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); rectY += _lineInc; } prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // 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 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Boolean formAsMacro, UInt32 codePoint, Int32 indxFont, PCLFonts.eVariant fontVar) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; UInt16[] textArray = { 0x00 }; Int16 posX, posY; Int32 indStd; Int16 ptSize; Byte[] utf8Seq = new Byte[4]; Int32 utf8Len = 0; String utf8HexVal = ""; //----------------------------------------------------------------// indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// // // // Code-point data. // // // //----------------------------------------------------------------// ptSize = 18; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameArial); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); posX = _posXData; posY = _posYData; if (codePoint < 0x010000) { PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, "U+" + codePoint.ToString("x4")); } else { // should not happen 'cos XL only supports 16-bit values ! PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, "U+" + codePoint.ToString("x6")); } PrnParseDataUTF8.convertUTF32ToUTF8Bytes(codePoint, ref utf8Len, ref utf8Seq); PrnParseDataUTF8.convertUTF32ToUTF8HexString(codePoint, true, ref utf8HexVal); posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, utf8HexVal); //----------------------------------------------------------------// // // // Font data. // // // //----------------------------------------------------------------// posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_ArialRegular, ptSize, posX, posY, PCLFonts.getName(indxFont) + " " + Enum.GetName(typeof(PCLFonts.eVariant), fontVar)); posY += _lineInc; ptSize = 36; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_18N, PCLFonts.getPCLXLName(indxFont, fontVar)); textArray[0] = (UInt16)codePoint; PCLXLWriter.textChar(prnWriter, false, 0, // ***** dummy value ***** ptSize, posX, posY, (UInt16)codePoint); //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // 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 indxPaperSize, Int32 indxPaperType, Int32 indxOrientation, Int32[] sampleDef, Boolean formAsMacro) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; Int16 posX, posY, rectX, rectY, rectHeight, rectWidth; Int32 indStd; Int16 ptSize; // Int32 temp; Byte shade_0, shade_1, shade_2, shade_3; indStd = 0; //----------------------------------------------------------------// if (indxOrientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(indxOrientation)); } if (indxPaperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(indxPaperSize)); } if ((indxPaperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(indxPaperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(indxPaperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// if (formAsMacro) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.StreamName, _formName); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.ExecStream); prnWriter.Write(bufStd, 0, indStd); indStd = 0; } else { generateOverlay(prnWriter, false, indxPaperSize, indxOrientation); } //----------------------------------------------------------------// rectHeight = (Int16)(_lineInc / 2); rectWidth = _lineInc; //----------------------------------------------------------------// // // // Colour definitions. // // // //----------------------------------------------------------------// shade_0 = (Byte)(sampleDef[0] & 0xff); shade_1 = (Byte)(sampleDef[1] & 0xff); shade_2 = (Byte)(sampleDef[2] & 0xff); shade_3 = (Byte)(sampleDef[3] & 0xff); //----------------------------------------------------------------// // // // Write details. // // // //----------------------------------------------------------------// ptSize = 12; PCLXLWriter.font(prnWriter, false, ptSize, _symSet_19U, _fontNameCourier); posX = _posXDesc; posY = _posYHddr; //----------------------------------------------------------------// posX = _posXDesc4; posY = _posYDesc4; posX += _incInch; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "0x" + shade_0.ToString("x2")); posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "0x" + shade_1.ToString("x2")); posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "0x" + shade_2.ToString("x2")); posY += _lineInc; PCLXLWriter.text(prnWriter, false, false, PCLXLWriter.advances_Courier, ptSize, posX, posY, "0x" + shade_3.ToString("x2")); //----------------------------------------------------------------// // // // Gray colour space. // // // //----------------------------------------------------------------// posX = _posXData; posY = _posYData; rectX = posX; rectY = posY; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.ColorSpace, (Byte)PCLXLAttrEnums.eVal.eGray); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetColorSpace); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.NullPen, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, shade_0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// rectY += _lineInc; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, shade_1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// rectY += _lineInc; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, shade_2); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// rectY += _lineInc; PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.GrayLevel, shade_3); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUint16Box(ref bufStd, ref indStd, PCLXLAttributes.eTag.BoundingBox, (UInt16)rectX, (UInt16)rectY, (UInt16)(rectX + rectWidth), (UInt16)(rectY + rectHeight)); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.Rectangle); prnWriter.Write(bufStd, 0, indStd); indStd = 0; //----------------------------------------------------------------// PCLXLWriter.addAttrUint16(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageCopies, 1); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.EndPage); prnWriter.Write(bufStd, 0, indStd); }
//--------------------------------------------------------------------// // 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) { const Int32 sizeStd = 1024; Byte[] bufStd = new Byte[sizeStd]; Int32 indStd; PCLXLWriter.stdJobHeader(prnWriter, ""); indStd = 0; if (orientation < PCLOrientations.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.Orientation, PCLOrientations.getIdPCLXL(orientation)); } if (paperSize < PCLPaperSizes.getCount()) { PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaSize, PCLPaperSizes.getIdPCLXL(paperSize)); } if ((paperType < PCLPaperTypes.getCount()) && (PCLPaperTypes.getType(paperType) != PCLPaperTypes.eEntryType.NotSet)) { PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.MediaType, PCLPaperTypes.getName(paperType)); } PCLXLWriter.addAttrUbyte(ref bufStd, ref indStd, PCLXLAttributes.eTag.SimplexPageMode, (Byte)PCLXLAttrEnums.eVal.eSimplexFrontSide); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.BeginPage); PCLXLWriter.addAttrUint16XY(ref bufStd, ref indStd, PCLXLAttributes.eTag.PageOrigin, 0, 0); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPageOrigin); PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.RGBColor, 3, PCLXLWriter.rgbBlack); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetBrushSource); PCLXLWriter.addAttrUbyteArray(ref bufStd, ref indStd, PCLXLAttributes.eTag.RGBColor, 3, PCLXLWriter.rgbBlack); PCLXLWriter.addOperator(ref bufStd, ref indStd, PCLXLOperators.eTag.SetPenSource); prnWriter.Write(bufStd, 0, indStd); }