//--------------------------------------------------------------------//
        //                                                        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,
                                            Int32 indxPaperSize,
                                            Int32 indxOrientation)
        {
            const Int32 lenBuf = 1024;

            Byte[] buffer = new Byte[lenBuf];

            Int16 ptSize;

            Int32 indBuf;

            Int16 posX,
                  posY;

            UInt16 boxX1,
                   boxX2,
                   boxY1,
                   boxY2;

            Int16 rectX,
                  rectY,
                  rectHeight,
                  rectWidth;

            Byte stroke = 1;

            //----------------------------------------------------------------//

            indBuf = 0;

            //----------------------------------------------------------------//
            //                                                                //
            // Header                                                         //
            // Parts of overlay use different brush and/or pen definitions,   //
            // so enclosed in a GS block.                                     //
            //                                                                //
            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, _formName);
            }

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PushGS);

            //----------------------------------------------------------------//
            //                                                                //
            // Colour space, pen & brush definitions.                         //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PaletteDepth,
                                     (Byte)PCLXLAttrEnums.eVal.e8Bit);

            PCLXLWriter.addAttrUbyteArray(ref buffer,
                                          ref indBuf,
                                          PCLXLAttributes.eTag.PaletteData,
                                          2,
                                          PCLXLWriter.monoPalette);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     stroke);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Box.                                                           //
            //                                                                //
            //----------------------------------------------------------------//

            boxX1 = _unitsPerInch / 2;  // half-inch left margin
            boxY1 = _unitsPerInch / 2;  // half-inch top-margin

            boxX2 = (UInt16)(PCLPaperSizes.getPaperWidth(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxX1);

            boxY2 = (UInt16)(PCLPaperSizes.getPaperLength(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxY1);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetSourceTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     5);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.EllipseDimension,
                                        100, 100);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         boxX1, boxY1, boxX2, boxY2);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.RoundRectangle);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Text.                                                          //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullPen,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            ptSize = 15;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourierBold);

            posX = _posXDesc;
            posY = _posYHddr;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "PCL XL Text & Background:");

            ptSize = 12;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            posY = _posYDesc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Black:");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Shade = " + "Dark Gray:");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Shade = " + "Light Gray:");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "White:");

            //----------------------------------------------------------------//
            //                                                                //
            // Background shading.                                            //
            //                                                                //
            //----------------------------------------------------------------//

            patternDefineDpi300(prnWriter, formAsMacro);

            rectHeight = (Int16)((_lineInc * 3) / 5);
            rectWidth  = (Int16)((_unitsPerInch * 9) / 10);

            posX = _posXData;
            posY = _posYData - (_lineInc / 2);

            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            rectX = posX;
            rectY = posY;

            for (Int32 i = 0; i < 4; i++)
            {
                PCLXLWriter.addAttrUint16Box(ref buffer,
                                             ref indBuf,
                                             PCLXLAttributes.eTag.BoundingBox,
                                             (UInt16)rectX,
                                             (UInt16)rectY,
                                             (UInt16)(rectX + rectWidth),
                                             (UInt16)(rectY + rectHeight));

                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.Rectangle);

                rectY += _lineInc;
            }

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//

            PCLXLWriter.addAttrSint16(ref buffer,
                                      ref indBuf,
                                      PCLXLAttributes.eTag.PatternSelectID,
                                      _patternId_DarkGrey);

            PCLXLWriter.addAttrSint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.PatternOrigin,
                                        0, 0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            rectX += rectWidth;
            rectY  = posY;

            for (Int32 i = 0; i < 4; i++)
            {
                PCLXLWriter.addAttrUint16Box(ref buffer,
                                             ref indBuf,
                                             PCLXLAttributes.eTag.BoundingBox,
                                             (UInt16)rectX,
                                             (UInt16)rectY,
                                             (UInt16)(rectX + rectWidth),
                                             (UInt16)(rectY + rectHeight));

                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.Rectangle);

                rectY += _lineInc;
            }

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//

            PCLXLWriter.addAttrSint16(ref buffer,
                                      ref indBuf,
                                      PCLXLAttributes.eTag.PatternSelectID,
                                      _patternId_LightGrey);

            PCLXLWriter.addAttrSint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.PatternOrigin,
                                        0, 0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            rectX += rectWidth;
            rectY  = posY;

            for (Int32 i = 0; i < 4; i++)
            {
                PCLXLWriter.addAttrUint16Box(ref buffer,
                                             ref indBuf,
                                             PCLXLAttributes.eTag.BoundingBox,
                                             (UInt16)rectX,
                                             (UInt16)rectY,
                                             (UInt16)(rectX + rectWidth),
                                             (UInt16)(rectY + rectHeight));

                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.Rectangle);

                rectY += _lineInc;
            }

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Overlay end.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PopGS);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }
        //--------------------------------------------------------------------//
        //                                                        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,
                                            Int32 indxPaperSize,
                                            Int32 indxOrientation)
        {
            const Int32 lenBuf = 1024;

            Byte[] buffer = new Byte[lenBuf];

            Int16 ptSize;

            Int32 indBuf;

            Int16 posX,
                  posY;

            UInt16 boxX1,
                   boxX2,
                   boxY1,
                   boxY2;

            Byte stroke = 1;

            //----------------------------------------------------------------//

            indBuf = 0;

            //----------------------------------------------------------------//
            //                                                                //
            // Header                                                         //
            //                                                                //
            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, _formName);
            }

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PushGS);

            //----------------------------------------------------------------//
            //                                                                //
            // Colour space, pen & brush definitions.                         //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     stroke);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Box.                                                           //
            // This uses different brush and/or pen definitions, so enclosed  //
            // in a GS block.                                                 //
            //                                                                //
            //----------------------------------------------------------------//

            boxX1 = _unitsPerInch / 2;  // half-inch left margin
            boxY1 = _unitsPerInch / 2;  // half-inch top-margin

            boxX2 = (UInt16)(PCLPaperSizes.getPaperWidth(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxX1);

            boxY2 = (UInt16)(PCLPaperSizes.getPaperLength(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxY1);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetSourceTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     5);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.EllipseDimension,
                                        100, 100);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         boxX1, boxY1, boxX2, boxY2);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.RoundRectangle);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Text.                                                          //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullPen,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            ptSize = 15;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourierBold);

            posX = _posXDesc;
            posY = _posYDesc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "PCL XL Text Rotation:");

            ptSize = 12;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Font");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Angle | scale | X & Y spacing");

            //----------------------------------------------------------------//
            //                                                                //
            // Overlay end.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PopGS);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }
Beispiel #3
0
        //--------------------------------------------------------------------//
        //                                                        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,
                                            Int32 indxPaperSize,
                                            Int32 indxOrientation)
        {
            const Int32 lenBuf = 1024;

            Byte[] buffer = new Byte[lenBuf];

            Int16 ptSize;

            Int32 indBuf;

            Int16 posX,
                  posY;

            UInt16 boxX1,
                   boxX2,
                   boxY1,
                   boxY2;

            Byte stroke = 1;

            //----------------------------------------------------------------//

            indBuf = 0;

            //----------------------------------------------------------------//
            //                                                                //
            // Header                                                         //
            //                                                                //
            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, _formName);
            }

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PushGS);

            //----------------------------------------------------------------//
            //                                                                //
            // Colour space, pen & brush definitions.                         //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     stroke);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Box.                                                           //
            //                                                                //
            //----------------------------------------------------------------//

            boxX1 = _unitsPerInch / 2;  // half-inch left margin
            boxY1 = _unitsPerInch / 2;  // half-inch top-margin

            boxX2 = (UInt16)(PCLPaperSizes.getPaperWidth(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxX1);

            boxY2 = (UInt16)(PCLPaperSizes.getPaperLength(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxY1);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetSourceTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     5);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.EllipseDimension,
                                        100, 100);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         boxX1, boxY1, boxX2, boxY2);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.RoundRectangle);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Text.                                                          //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullPen,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            ptSize = 15;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourierBold);

            posX = _posXDesc;
            posY = _posYHddr;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "PCL XL cross-hatch patterns:");

            //----------------------------------------------------------------//

            ptSize = 12;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            posY = _posYDesc1;

            for (Int32 i = 0; i < _patternsCt; i++)
            {
                PCLXLWriter.text(prnWriter, formAsMacro, false,
                                 PCLXLWriter.advances_Courier, ptSize,
                                 posX, posY,
                                 "#" + _patternIds[i].ToString() + ": ");

                posY += _lineInc;
            }

            //----------------------------------------------------------------//

            ptSize = 10;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            //----------------------------------------------------------------//

            posY = _posYDesc1 + (_lineInc / 4);

            for (Int32 i = 0; i < _patternsCt; i++)
            {
                PCLXLWriter.text(prnWriter, formAsMacro, false,
                                 PCLXLWriter.advances_Courier, ptSize,
                                 posX, posY,
                                 _patternDescs[i] + ":");

                posY += _lineInc;
            }

            //----------------------------------------------------------------//

            ptSize = 8;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            //----------------------------------------------------------------//

            posY = _posYDesc2;
            posX = _posXData1;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Predefined");

            posX = _posXData2;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "User-defined 300 dpi");

            posX = _posXData3;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "User-defined 600 dpi");

            //----------------------------------------------------------------//
            //                                                                //
            // Overlay end.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PopGS);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }
Beispiel #4
0
        //--------------------------------------------------------------------//
        //                                                        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,
                                            Int32 indxPaperSize,
                                            Int32 indxOrientation)
        {
            const Int32 lenBuf = 1024;

            Byte[] buffer = new Byte[lenBuf];

            Int16 ptSize;

            Int32 indBuf;

            Int16 posX,
                  posY;

            UInt16 boxX1,
                   boxX2,
                   boxY1,
                   boxY2;

            Int16 rectX,
                  rectY,
                  rectHeight,
                  rectWidth;

            Byte stroke = 1;

            //----------------------------------------------------------------//

            indBuf = 0;

            //----------------------------------------------------------------//
            //                                                                //
            // Header                                                         //
            //                                                                //
            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, _formName);
            }

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PushGS);

            //----------------------------------------------------------------//
            //                                                                //
            // Colour space, pen & brush definitions.                         //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     stroke);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Box.                                                           //
            //                                                                //
            //----------------------------------------------------------------//

            boxX1 = _unitsPerInch / 2;  // half-inch left margin
            boxY1 = _unitsPerInch / 2;  // half-inch top-margin

            boxX2 = (UInt16)(PCLPaperSizes.getPaperWidth(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxX1);

            boxY2 = (UInt16)(PCLPaperSizes.getPaperLength(
                                 indxPaperSize, _unitsPerInch,
                                 PCLOrientations.eAspect.Portrait) -
                             boxY1);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetSourceTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     5);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.EllipseDimension,
                                        100, 100);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         boxX1, boxY1, boxX2, boxY2);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.RoundRectangle);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//
            //                                                                //
            // Text.                                                          //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     100);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullPen,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            ptSize = 15;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourierBold);

            posX = _posXDesc;
            posY = _posYHddr;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "PCL XL Gray colour mode:");

            //----------------------------------------------------------------//

            ptSize = 12;

            PCLXLWriter.font(prnWriter, formAsMacro, ptSize,
                             _symSet_19U, _fontNameCourier);

            posY += _incInch / 2;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Sample 4-shade palette:");

            //----------------------------------------------------------------//

            posX = _posXDesc2;
            posY = _posYDesc2;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "Gray");

            //----------------------------------------------------------------//

            posX = _posXDesc3;
            posY = _posYDesc3;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "index");

            posX += _incInch;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "value");

            //----------------------------------------------------------------//

            posX = _posXDesc4;
            posY = _posYDesc4;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "0");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "1");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "2");

            posY += _lineInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_Courier, ptSize,
                             posX, posY,
                             "3");

            //----------------------------------------------------------------//
            //                                                                //
            // Background shade.                                              //
            //                                                                //
            //----------------------------------------------------------------//

            rectX      = _posXDesc2 - (_incInch / 4);
            rectY      = _posYDesc2 + (_incInch / 4);
            rectWidth  = (_incInch * 13) / 10;
            rectHeight = (_incInch * 7) / 2;

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PaletteDepth,
                                     (Byte)PCLXLAttrEnums.eVal.e8Bit);

            PCLXLWriter.addAttrUbyteArray(ref buffer,
                                          ref indBuf,
                                          PCLXLAttributes.eTag.PaletteData,
                                          2,
                                          PCLXLWriter.monoPalette);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            patternDefineDpi600(prnWriter, _patternId_1, formAsMacro);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullPen,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrSint16(ref buffer,
                                      ref indBuf,
                                      PCLXLAttributes.eTag.PatternSelectID,
                                      601);

            PCLXLWriter.addAttrSint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.PatternOrigin,
                                        0, 0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         (UInt16)rectX,
                                         (UInt16)rectY,
                                         (UInt16)(rectX + rectWidth),
                                         (UInt16)(rectY + rectHeight));

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.Rectangle);

            //----------------------------------------------------------------//
            //                                                                //
            // Overlay end.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PopGS);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e O v e r l a y R e a r                              //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write background data sequences for rear overlay to output file.   //
        // Optionally top and tail these with macro (user-defined stream)     //
        // definition sequences.                                              //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generateOverlayRear(BinaryWriter prnWriter,
                                                Boolean formAsMacro,
                                                String formName,
                                                Single scaleFactor)
        {
            const Int32 lenBuf = 1024;

            Byte[] buffer = new Byte[lenBuf];

            Int32 indBuf;

            Int16 posX,
                  posY,
                  posYInc;

            Int32 ptSizeHddr = (Int32)(scaleFactor * 24),
                  ptSizeMain = (Int32)(scaleFactor * 18);

            indBuf = 0;

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, formName);
            }

            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     128);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//

            PCLXLWriter.font(prnWriter, formAsMacro, ptSizeHddr,
                             629, "Arial         Bd");

            //----------------------------------------------------------------//

            posYInc = (Int16)(scaleFactor * _posYIncMain);

            posX = (Int16)(scaleFactor * _posXName);
            posY = (Int16)(scaleFactor * _posYHddr);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeHddr,
                             posX, posY, "Tray map test (PCL XL)");

            //----------------------------------------------------------------//

            PCLXLWriter.font(prnWriter, formAsMacro, ptSizeMain,
                             629, "Arial         Bd");

            //----------------------------------------------------------------//

            posY = (Int16)(scaleFactor * _posYDesc);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Page Number:");

            posY += (Int16)(posYInc * 4);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Orientation:");

            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e O v e r l a y F r o n t                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write background data sequences for front overlay to output file.  //
        // Optionally top and tail these with macro (user-defined stream)     //
        // definition sequences.                                              //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generateOverlayFront(BinaryWriter prnWriter,
                                                 Boolean formAsMacro,
                                                 String formName,
                                                 Single scaleFactor)
        {
            const Int32 lenBuf = 1024;

            Int16 rectHeight = (Int16)(scaleFactor * (_unitsPerInch / 2));
            Int16 rectWidth  = (Int16)(scaleFactor * ((_unitsPerInch * 7) / 2));
            Int16 rectStroke = (Int16)(scaleFactor * (_unitsPerInch / 200));
            Int16 rectCorner = (Int16)(scaleFactor * (_unitsPerInch / 3));

            Int16 ptSizeHddr = (Int16)(scaleFactor * 24),
                  ptSizeMain = (Int16)(scaleFactor * 18),
                  ptSizeSub  = (Int16)(scaleFactor * 8);

            Byte[] buffer = new Byte[lenBuf];

            Int32 indBuf;

            Int16 posX,
                  posY,
                  posYInc;

            indBuf = 0;

            if (formAsMacro)
            {
                PCLXLWriter.streamHeader(prnWriter, true, formName);
            }

            //----------------------------------------------------------------//

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.ColorSpace,
                                     (Byte)PCLXLAttrEnums.eVal.eGray);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetColorSpace);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     128);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//

            PCLXLWriter.font(prnWriter, formAsMacro, ptSizeHddr,
                             629, "Arial         Bd");

            //----------------------------------------------------------------//

            posYInc = (Int16)(scaleFactor * _posYIncMain);
            posX    = (Int16)(scaleFactor * _posXName);
            posY    = (Int16)(scaleFactor * _posYHddr);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeHddr,
                             posX, posY, "Tray map test (PCL XL)");

            //----------------------------------------------------------------//

            PCLXLWriter.font(prnWriter, formAsMacro, ptSizeMain,
                             629, "Arial         Bd");

            //----------------------------------------------------------------//

            posY = (Int16)(scaleFactor * _posYDesc);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Page Number:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Paper Size:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Paper Type:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Plex Mode:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Orientation:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "PCL XL Tray ID:");

            posY += posYInc;

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeMain,
                             posX, posY, "Printer Tray:");

            //----------------------------------------------------------------//

            PCLXLWriter.font(prnWriter, formAsMacro, ptSizeSub,
                             629, "Arial         Bd");

            //----------------------------------------------------------------//

            posX  = (Int16)(scaleFactor * (_posXValue + _posXIncSub));
            posY += (Int16)(scaleFactor * _posYIncSub);

            PCLXLWriter.text(prnWriter, formAsMacro, false,
                             PCLXLWriter.advances_ArialBold, ptSizeSub,
                             posX, posY,
                             "record the tray name/number used in this box");

            //----------------------------------------------------------------//

            posX  = (Int16)(scaleFactor * _posXValue);
            posY -= (Int16)(scaleFactor * (_posXIncSub * 2));

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PushGS);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPatternTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.TxMode,
                                     (Byte)PCLXLAttrEnums.eVal.eTransparent);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetSourceTxMode);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.GrayLevel,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenSource);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.PenWidth,
                                     (Byte)rectStroke);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetPenWidth);

            PCLXLWriter.addAttrUbyte(ref buffer,
                                     ref indBuf,
                                     PCLXLAttributes.eTag.NullBrush,
                                     0);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.SetBrushSource);

            PCLXLWriter.addAttrUint16XY(ref buffer,
                                        ref indBuf,
                                        PCLXLAttributes.eTag.EllipseDimension,
                                        (UInt16)rectCorner, (UInt16)rectCorner);

            PCLXLWriter.addAttrUint16Box(ref buffer,
                                         ref indBuf,
                                         PCLXLAttributes.eTag.BoundingBox,
                                         (UInt16)posX, (UInt16)posY,
                                         (UInt16)(posX + rectWidth),
                                         (UInt16)(posY + rectHeight));

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.RoundRectangle);

            PCLXLWriter.addOperator(ref buffer,
                                    ref indBuf,
                                    PCLXLOperators.eTag.PopGS);

            PCLXLWriter.writeStreamBlock(prnWriter, formAsMacro,
                                         buffer, ref indBuf);

            //----------------------------------------------------------------//

            if (formAsMacro)
            {
                PCLXLWriter.addOperator(ref buffer,
                                        ref indBuf,
                                        PCLXLOperators.eTag.EndStream);

                prnWriter.Write(buffer, 0, indBuf);
            }
        }