//--------------------------------------------------------------------//
        //                                                        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,
                                         UInt16 logXOffset)
        {
            Int16 posX,
                  posY,
                  rectX,
                  rectY,
                  rectHeight,
                  rectWidth;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            rectHeight = (Int16)(_lineInc / 2);
            rectWidth  = _lineInc;

            //----------------------------------------------------------------//
            //                                                                //
            // Pre-defined cross-hatch pattenrs.                              //
            //                                                                //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData1 - logXOffset);
            posY = _posYData;

            rectX = posX;
            rectY = posY;

            for (Int32 i = 0; i < _patternsCt; i++)
            {
                PCLWriter.rectangleXHatch(prnWriter, rectX, rectY,
                                          rectHeight, rectWidth,
                                          (Int16)_patternIds[i]);

                rectY += _lineInc;
            }

            //----------------------------------------------------------------//
            //                                                                //
            // User-defined 300 dpi cross-hatch patterns.                     //
            //                                                                //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData2 - logXOffset);
            posY = _posYData;

            rectX = posX;
            rectY = posY;

            for (Int32 i = 0; i < _patternsCt; i++)
            {
                PCLWriter.rectangleUserFill(
                    prnWriter, rectX, rectY,
                    rectHeight, rectWidth,
                    (Int16)(_patternBase_300 + _patternIds[i]),
                    false, false);

                rectY += _lineInc;
            }

            //----------------------------------------------------------------//
            //                                                                //
            // User-defined 600 dpi cross-hatch patterns.                     //
            //                                                                //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData3 - logXOffset);
            posY = _posYData;

            rectX = posX;
            rectY = posY;

            for (Int32 i = 0; i < _patternsCt; i++)
            {
                PCLWriter.rectangleUserFill(
                    prnWriter, rectX, rectY,
                    rectHeight, rectWidth,
                    (Int16)(_patternBase_600 + _patternIds[i]),
                    false, false);

                rectY += _lineInc;
            }

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

            PCLWriter.formFeed(prnWriter);
        }
Пример #2
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 pageNo,
                                         Int32 pageCount,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxPaperTray,
                                         Int32 indxPlexMode,
                                         Int32 indxOrientFront,
                                         Int32 indxOrientRear,
                                         Int16 macroIdFront,
                                         Int16 macroIdRear,
                                         Single scaleFactor,
                                         Boolean formAsMacro)
        {
            Int16 posX,
                  posY,
                  posYInc;

            Int32 pitchMain = (Int32)(6 / scaleFactor);

            Boolean simplex = PCLPlexModes.isSimplex(indxPlexMode);

            PCLWriter.pageHeader(prnWriter,
                                 indxPaperSize,
                                 indxPaperType,
                                 indxOrientFront,
                                 indxPlexMode);

            if (indxPaperTray != -1)
            {
                PCLWriter.paperSource(prnWriter, (Int16)indxPaperTray);
            }

            if (!simplex)
            {
                PCLWriter.pageFace(prnWriter, true);
            }

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, macroIdFront,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlayFront(prnWriter, false,
                                     _noForm, scaleFactor);
            }

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

            posYInc = (Int16)(scaleFactor * _posYIncMain);

            posX = (Int16)((scaleFactor * _posXValue) - _logPageOffset);
            posY = (Int16)((scaleFactor * _posYDesc));

            PCLWriter.font(prnWriter, true,
                           "19U", "s0p" + pitchMain + "h0s3b4099T");

            if (simplex)
            {
                PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() +
                               " of " +
                               pageCount.ToString());
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() +
                               " of " +
                               pageCount.ToString());
            }

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

            posY += posYInc;

            if (indxPaperSize >= PCLPaperSizes.getCount())
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPaperSizes.getName(indxPaperSize));
            }

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

            posY += posYInc;

            if (indxPaperType >= PCLPaperTypes.getCount())
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***");
            }
            else if (PCLPaperTypes.getType(indxPaperType) ==
                     PCLPaperTypes.eEntryType.NotSet)
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "<not set>");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPaperTypes.getName(indxPaperType));
            }

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

            posY += posYInc;

            if (indxPlexMode >= PCLPlexModes.getCount())
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPlexModes.getName(indxPlexMode));
            }

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

            posY += posYInc;

            if (indxOrientFront >= PCLOrientations.getCount())
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLOrientations.getName(indxOrientFront));
            }

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

            posY += posYInc;

            if (indxPaperTray == PCLTrayDatas.getIdNotSetPCL())
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "<not set>");
            }
            else if (indxPaperTray == _trayIdAutoSelectPCL)
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               indxPaperTray.ToString() + " (auto-select)");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               indxPaperTray.ToString());
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Rear face (if not simplex)                                     //
            //                                                                //
            //----------------------------------------------------------------//

            if (!simplex)
            {
                if (indxOrientRear != indxOrientFront)
                {
                    PCLWriter.pageOrientation(
                        prnWriter,
                        PCLOrientations.getIdPCL(indxOrientRear).ToString());
                }

                PCLWriter.pageFace(prnWriter, false);

                if (formAsMacro)
                {
                    PCLWriter.macroControl(prnWriter, macroIdRear,
                                           PCLWriter.eMacroControl.Call);
                }
                else
                {
                    generateOverlayRear(prnWriter, false,
                                        _noForm, scaleFactor);
                }

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

                posX = (Int16)((scaleFactor * _posXValue) - _logPageOffset);
                posY = (Int16)(scaleFactor * _posYDesc);

                PCLWriter.font(prnWriter, true,
                               "19U", "s0p" + pitchMain + "h0s3b4099T");

                PCLWriter.text(prnWriter, posX, posY, 0, pageNo.ToString() +
                               " (rear) of " +
                               pageCount.ToString());

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

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

                if (indxOrientRear >= PCLOrientations.getCount())
                {
                    PCLWriter.text(prnWriter, posX, posY, 0, "*** unknown ***");
                }
                else
                {
                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   PCLOrientations.getName(indxOrientRear));
                }
            }

            PCLWriter.formFeed(prnWriter);
        }
Пример #3
0
        //--------------------------------------------------------------------//
        //                                                        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,
                                         UInt16 logXOffset)
        {
            Int16 posX,
                  posY,
                  rectX,
                  rectY,
                  rectHeight,
                  rectWidth;

            Int16 ptSize;

            Int32 temp;

            Byte [] palette_0 = new Byte[3],
            palette_1 = new Byte[3],
            palette_2 = new Byte[3],
            palette_3 = new Byte[3];

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            rectHeight = (Int16)(_lineInc / 2);
            rectWidth  = _lineInc;

            //----------------------------------------------------------------//
            //                                                                //
            // Set pattern transparency to Opaque so that white samples show  //
            // on the shaded background.                                      //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.patternTransparency(prnWriter,
                                          true);

            //----------------------------------------------------------------//
            //                                                                //
            // Colour definitions.                                            //
            //                                                                //
            //----------------------------------------------------------------//

            temp = sampleDef [0];

            palette_0 [2] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_0 [1] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_0 [0] = (Byte)(temp & 0xff);

            temp = sampleDef [1];

            palette_1 [2] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_1 [1] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_1 [0] = (Byte)(temp & 0xff);

            temp = sampleDef [2];

            palette_2 [2] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_2 [1] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_2 [0] = (Byte)(temp & 0xff);

            temp = sampleDef [3];

            palette_3 [2] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_3 [1] = (Byte)(temp & 0xff);
            temp          = temp >> 8;
            palette_3 [0] = (Byte)(temp & 0xff);

            //----------------------------------------------------------------//
            //                                                                //
            // Write details.                                                 //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 12;

            PCLWriter.font(prnWriter, true, "19U",
                           PCLFonts.getPCLFontSelect(_indxFontCourier,
                                                     PCLFonts.eVariant.Regular,
                                                     ptSize, 0));

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

            posX = (Int16)(_posXDesc4 - logXOffset);
            posY = _posYDesc4;

            posX += _incInch;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "0x" +
                           palette_0 [0].ToString("x2") +
                           palette_0 [1].ToString("x2") +
                           palette_0 [2].ToString("x2"));

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "0x" +
                           palette_1 [0].ToString("x2") +
                           palette_1 [1].ToString("x2") +
                           palette_1 [2].ToString("x2"));

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "0x" +
                           palette_2 [0].ToString("x2") +
                           palette_2 [1].ToString("x2") +
                           palette_2 [2].ToString("x2"));

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "0x" +
                           palette_3 [0].ToString("x2") +
                           palette_3 [1].ToString("x2") +
                           palette_3 [2].ToString("x2"));

            //----------------------------------------------------------------//
            //                                                                //
            // RGB colour space.                                              //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.configureImageData(prnWriter,
                                         0,     // colour space = RGB
                                         1,     // PEM = Direct-by-pixel
                                         2,     // 2 bitsPerindex -> 4 colours
                                         8,     // bits per component - ignored
                                         8,     // bits per component - ignored
                                         8);    // bits per component - ignored

            PCLWriter.paletteEntry(prnWriter,
                                   0,
                                   palette_0 [0], palette_0 [1], palette_0 [2]);

            PCLWriter.paletteEntry(prnWriter,
                                   1,
                                   palette_1 [0], palette_1 [1], palette_1 [2]);

            PCLWriter.paletteEntry(prnWriter,
                                   2,
                                   palette_2 [0], palette_2 [1], palette_2 [2]);

            PCLWriter.paletteEntry(prnWriter,
                                   3,
                                   palette_3 [0], palette_3 [1], palette_3 [2]);

            posX = (Int16)(_posXData - logXOffset);
            posY = _posYData;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 2);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 3);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            //----------------------------------------------------------------//
            //                                                                //
            // CMY colour space.                                              //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.configureImageData(prnWriter,
                                         1,     // colour space = CMY
                                         1,     // PEM = Direct-by-pixel
                                         2,     // 2 bitsPerindex -> 4 colours
                                         8,     // bits per component - ignored
                                         8,     // bits per component - ignored
                                         8);    // bits per component - ignored

            PCLWriter.paletteEntry(prnWriter,
                                   0,
                                   palette_0[0], palette_0[1], palette_0[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   1,
                                   palette_1[0], palette_1[1], palette_1[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   2,
                                   palette_2[0], palette_2[1], palette_2[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   3,
                                   palette_3[0], palette_3[1], palette_3[2]);

            posX += _colInc;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 2);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 3);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            //----------------------------------------------------------------//
            //                                                                //
            // SRGB colour space.                                             //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.configureImageData(prnWriter,
                                         2,     // colour space = SRGB
                                         1,     // PEM = Direct-by-pixel
                                         2,     // 2 bitsPerindex -> 4 colours
                                         8,     // bits per component - ignored
                                         8,     // bits per component - ignored
                                         8);    // bits per component - ignored

            PCLWriter.paletteEntry(prnWriter,
                                   0,
                                   palette_0[0], palette_0[1], palette_0[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   1,
                                   palette_1[0], palette_1[1], palette_1[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   2,
                                   palette_2[0], palette_2[1], palette_2[2]);

            PCLWriter.paletteEntry(prnWriter,
                                   3,
                                   palette_3[0], palette_3[1], palette_3[2]);

            posX += _colInc;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 2);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 3);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

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

            PCLWriter.formFeed(prnWriter);
        }
Пример #4
0
        //--------------------------------------------------------------------//
        //                                                        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,
                                         UInt16 logXOffset)
        {
            String sampleText = "000000000000000";

            Int16 posX,
                  posY;

            Int16 ptSize;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

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

            ptSize = 36;

            PCLWriter.font(prnWriter, true, "19U",
                           PCLFonts.getPCLFontSelect(_indxFontArial,
                                                     PCLFonts.eVariant.Regular,
                                                     ptSize, 0));

            //----------------------------------------------------------------//
            // Black                                                          //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData - logXOffset);
            posY = _posYData;

            PCLWriter.patternTransparency(prnWriter, false);

            PCLWriter.patternSet(prnWriter,
                                 PCLWriter.ePatternType.SolidBlack,
                                 0);

            PCLWriter.text(prnWriter, posX, posY, 0, sampleText);

            //----------------------------------------------------------------//
            // Shade 1                                                        //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.patternTransparency(prnWriter, true);

            PCLWriter.patternSet(prnWriter,
                                 PCLWriter.ePatternType.Shading,
                                 _shade_1);

            PCLWriter.text(prnWriter, posX, posY, 0, sampleText);

            //----------------------------------------------------------------//
            // Shade 2                                                        //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.patternTransparency(prnWriter, true);

            PCLWriter.patternSet(prnWriter,
                                 PCLWriter.ePatternType.Shading,
                                 _shade_2);

            PCLWriter.text(prnWriter, posX, posY, 0, sampleText);

            //----------------------------------------------------------------//
            // White                                                          //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.patternTransparency(prnWriter, true);

            PCLWriter.patternSet(prnWriter,
                                 PCLWriter.ePatternType.SolidWhite,
                                 0);

            PCLWriter.text(prnWriter, posX, posY, 0, sampleText);

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

            PCLWriter.formFeed(prnWriter);
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxOrientation,
                                         Boolean formAsMacro,
                                         Boolean stdPage,
                                         UInt16 paperWidth,
                                         UInt16 paperLength,
                                         UInt16 logXOffset,
                                         Int16 logLeftOffset,
                                         Int16 logTopOffset,
                                         UInt16 logPageWidth,
                                         UInt16 logPageHeight)
        {
            const UInt16 dcptsPerInch = 720;

            const Double unitsToInches      = (1.00 / _unitsPerInch);
            const Double unitsToMilliMetres = (25.4 / _unitsPerInch);

            const Double dcptsToInches      = (1.00 / dcptsPerInch);
            const Double dcptsToMilliMetres = (25.4 / dcptsPerInch);

            Int16 posX,
                  posY;

            Int16 lineInc,
                  ptSize;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false,
                                paperWidth, paperLength, logXOffset);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Header.                                                        //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 15;

            PCLWriter.font(prnWriter, true, "19U",
                           "s1p" + ptSize + "v0s0b16602T");

            posX = (Int16)(_posXDesc - logXOffset);
            posY = _posYHddr;

            if (stdPage)
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               "PCL Standard Logical Page sample");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               "PCL Define Logical Page sample");
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Paper description data.                                        //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize  = 10;
            lineInc = _rulerDiv * 2;

            PCLWriter.font(prnWriter, true, "19U",
                           "s0p" + (120 / ptSize) + "h0s3b4099T");

            posX = (Int16)((_posXDesc + (_rulerCell * 2)) - logXOffset);
            posY = _posYDesc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           PCLPaperSizes.getName(indxPaperSize));

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           PCLOrientations.getName(indxOrientation));

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           (paperWidth * unitsToMilliMetres).ToString("F0") +
                           "mm = " +
                           (paperWidth * unitsToInches).ToString("F2") +
                           "\"");

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           (paperLength * unitsToMilliMetres).ToString("F0") +
                           "mm = " +
                           (paperLength * unitsToInches).ToString("F2") +
                           "\"");

            if (stdPage)
            {
                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               "standard");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               "standard");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               "standard");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               "standard");

                PCLWriter.formFeed(prnWriter);
            }
            else
            {
                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               logLeftOffset.ToString("F0") +
                               " decipoints = " +
                               (logLeftOffset * dcptsToMilliMetres).ToString("F0") +
                               "mm = " +
                               (logLeftOffset * dcptsToInches).ToString("F2") +
                               "\"");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               logTopOffset.ToString("F0") +
                               " decipoints = " +
                               (logTopOffset * dcptsToMilliMetres).ToString("F0") +
                               "mm = " +
                               (logTopOffset * dcptsToInches).ToString("F2") +
                               "\"");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               logPageWidth.ToString("F0") +
                               " decipoints = " +
                               (logPageWidth * dcptsToMilliMetres).ToString("F0") +
                               "mm = " +
                               (logPageWidth * dcptsToInches).ToString("F2") +
                               "\"");

                posY += lineInc;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               logPageHeight.ToString("F0") +
                               " decipoints = " +
                               (logPageHeight * dcptsToMilliMetres).ToString("F0") +
                               "mm = " +
                               (logPageHeight * dcptsToInches).ToString("F2") +
                               "\"");
            }
        }
Пример #6
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 pageNo,
                                         Int32 pageCount,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxOrientation,
                                         Int32 indxOrientRear,
                                         Int32 indxPlexMode,
                                         Boolean flagFrontFace,
                                         Boolean flagSimplexJob,
                                         Boolean flagMainForm,
                                         Boolean flagRearForm,
                                         Boolean flagMainOnPrnDisk,
                                         Boolean flagRearOnPrnDisk,
                                         Boolean flagRearBPlate,
                                         Boolean flagPrintDescText,
                                         String formFileMain,
                                         String formFileRear,
                                         eMacroMethod indxMethod,
                                         Int32 macroIdMain,
                                         Int32 macroIdRear)
        {
            const Int16 incPosY = 150;

            Boolean altOrient;
            Boolean pageUsesForm;
            Boolean firstPage;

            Int16 posX,
                  posY;

            Int32 macroId;
            Int32 indxOrient;

            altOrient = (indxOrientation != indxOrientRear);
            firstPage = (pageNo == 1);

            if (flagFrontFace)
            {
                indxOrient   = indxOrientation;
                pageUsesForm = flagMainForm;
                macroId      = macroIdMain;
            }
            else
            {
                indxOrient = indxOrientRear;

                if (flagRearForm)
                {
                    pageUsesForm = flagRearForm;
                    macroId      = macroIdRear;
                }
                else
                {
                    pageUsesForm = flagMainForm;
                    macroId      = macroIdMain;
                }
            }

            if (firstPage)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Generate first (or only) page header.                      //
                //                                                            //
                //------------------------------------------------------------//

                PCLWriter.pageHeader(prnWriter,
                                     indxPaperSize,
                                     indxPaperType,
                                     indxOrientation,
                                     indxPlexMode);

                if (indxMethod == eMacroMethod.Overlay)
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroIdMain,
                                           PCLWriter.eMacroControl.Overlay);
                }
            }
            else
            {
                //----------------------------------------------------------------//
                //                                                                //
                // Not first page:                                                //
                // - for simplex jobs:                                            //
                //      - write 'form feed' sequence.                             //
                // - for duplex jobs:                                             //
                //      - write 'page side' sequence.                             //
                //      - if rear face, and alternate orientations specified,     //
                //        write 'set orientation' sequence.                       //
                //                                                                //
                //----------------------------------------------------------------//

                if (flagSimplexJob)
                {
                    PCLWriter.formFeed(prnWriter);
                }
                else
                {
                    PCLWriter.pageFace(prnWriter, flagFrontFace);

                    if (altOrient)
                    {
                        PCLWriter.pageOrientation(
                            prnWriter,
                            PCLOrientations.getIdPCL(indxOrient).ToString());
                    }
                }
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Write any required 'begin page' macro 'call' or 'execute'      //
            // sequence.                                                      //
            //                                                                //
            //----------------------------------------------------------------//

            if (pageUsesForm)
            {
                if (indxMethod == eMacroMethod.CallBegin)
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroId,
                                           PCLWriter.eMacroControl.Call);
                }
                else if (indxMethod == eMacroMethod.ExecuteBegin)
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroId,
                                           PCLWriter.eMacroControl.Execute);
                }
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Write descriptive text headers.                                //
            //                                                                //
            //----------------------------------------------------------------//

            if (flagPrintDescText)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Write headers.                                             //
                //                                                            //
                //------------------------------------------------------------//

                PCLWriter.font(prnWriter, true, "19U", "s0p12h0s0b4099T");

                posX = 600 - _logPageOffset;
                posY = 1350;

                PCLWriter.text(prnWriter, posX, posY, 0, "Page:");

                if (firstPage)
                {
                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Paper size:");

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Paper type:");

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Plex mode:");

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Method:");

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Orientation:");

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0, "Rear orientation:");

                    posY += incPosY;

                    if (flagMainOnPrnDisk)
                    {
                        PCLWriter.text(prnWriter, posX, posY, 0,
                                       "Main form printer file:");
                    }
                    else
                    {
                        PCLWriter.text(prnWriter, posX, posY, 0,
                                       "Main form download file:");
                    }

                    posY += incPosY;

                    if (flagRearOnPrnDisk)
                    {
                        PCLWriter.text(prnWriter, posX, posY, 0,
                                       "Rear form printer file:");
                    }
                    else
                    {
                        PCLWriter.text(prnWriter, posX, posY, 0,
                                       "Rear form download file:");
                    }

                    posY += incPosY;

                    if ((flagRearForm) && (flagRearBPlate))
                    {
                        PCLWriter.text(prnWriter, posX, posY, 0,
                                       "Rear Form is boilerplate");
                    }
                }

                //------------------------------------------------------------//
                //                                                            //
                // Write variable data.                                       //
                //                                                            //
                //------------------------------------------------------------//

                PCLWriter.font(prnWriter, true, "19U", "s0p12h0s3b4099T");

                posX = 1920 - _logPageOffset;
                posY = 1350;

                PCLWriter.text(prnWriter, posX, posY, 0,
                               pageNo.ToString() + " of " +
                               pageCount.ToString());

                if (firstPage)
                {
                    String textOrientRear;

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   PCLPaperSizes.getName(indxPaperSize));

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   PCLPaperTypes.getName(indxPaperType));

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   PCLPlexModes.getName(indxPlexMode));

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   macroMethodNames[(Int32)indxMethod]);

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   PCLOrientations.getName(indxOrientation));

                    if (flagSimplexJob)
                    {
                        textOrientRear = "<not applicable>";
                    }
                    else if (altOrient)
                    {
                        textOrientRear = PCLOrientations.getName(indxOrientRear);
                    }
                    else
                    {
                        textOrientRear = "<not set>";
                    }

                    posY += incPosY;

                    PCLWriter.text(prnWriter, posX, posY, 0,
                                   textOrientRear);

                    posY += incPosY;

                    if (flagMainForm)
                    {
                        const Int32 maxLen  = 51;
                        const Int32 halfLen = (maxLen - 5) / 2;

                        Int32 len = formFileMain.Length;

                        if (len < maxLen)
                        {
                            PCLWriter.text(prnWriter, posX, posY, 0, formFileMain);
                        }
                        else
                        {
                            PCLWriter.text(prnWriter, posX, posY, 0,
                                           formFileMain.Substring(0, halfLen) +
                                           " ... " +
                                           formFileMain.Substring(len - halfLen,
                                                                  halfLen));
                        }
                    }

                    posY += incPosY;

                    if (flagRearForm)
                    {
                        const Int32 maxLen  = 51;
                        const Int32 halfLen = (maxLen - 5) / 2;

                        Int32 len = formFileRear.Length;

                        if (len < maxLen)
                        {
                            PCLWriter.text(prnWriter, posX, posY, 0, formFileRear);
                        }
                        else
                        {
                            PCLWriter.text(prnWriter, posX, posY, 0,
                                           formFileRear.Substring(0, halfLen) +
                                           " ... " +
                                           formFileRear.Substring(len - halfLen,
                                                                  halfLen));
                        }
                    }
                }
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Write any required 'end of page' macro 'call' or 'execute'     //
            // sequences.                                                     //
            //                                                                //
            //----------------------------------------------------------------//

            if (pageUsesForm)
            {
                if (indxMethod == eMacroMethod.CallEnd)
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroId,
                                           PCLWriter.eMacroControl.Call);
                }
                else if (indxMethod == eMacroMethod.ExecuteEnd)
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroId,
                                           PCLWriter.eMacroControl.Execute);
                }
            }

            //------------------------------------------------------------//
            //                                                            //
            // Generate rear boilerplate side if necessary.               //
            //                                                            //
            //------------------------------------------------------------//

            if ((flagRearForm) && (flagRearBPlate))
            {
                PCLWriter.pageFace(prnWriter, false);

                if (altOrient)
                {
                    PCLWriter.pageOrientation(
                        prnWriter,
                        PCLOrientations.getIdPCL(indxOrientRear).ToString());
                }

                if ((indxMethod == eMacroMethod.CallBegin) ||
                    (indxMethod == eMacroMethod.CallEnd))
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroIdRear,
                                           PCLWriter.eMacroControl.Call);
                }
                else if ((indxMethod == eMacroMethod.ExecuteBegin) ||
                         (indxMethod == eMacroMethod.ExecuteEnd))
                {
                    PCLWriter.macroControl(prnWriter,
                                           (Int16)macroIdRear,
                                           PCLWriter.eMacroControl.Execute);
                }
            }
        }
Пример #7
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e S e t                                      //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write set of test data pages to output file.                       //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePageSet(BinaryWriter prnWriter,
                                            Int32 pageCount,
                                            Int32 indxPaperSize,
                                            Int32 indxPaperType,
                                            Int32 indxOrientation,
                                            Int32 indxOrientRear,
                                            Int32 indxPlexMode,
                                            Boolean flagSimplexJob,
                                            Boolean flagMainForm,
                                            Boolean flagRearForm,
                                            Boolean flagMainOnPrnDisk,
                                            Boolean flagRearOnPrnDisk,
                                            Boolean flagRearBPlate,
                                            Boolean flagPrintDescText,
                                            String formFileMain,
                                            String formFileRear,
                                            eMacroMethod indxMethod,
                                            Int32 macroIdMain,
                                            Int32 macroIdRear)
        {
            Boolean flagFrontFace;

            flagFrontFace = true;

            for (Int32 pageNo = 1; pageNo <= pageCount; pageNo++)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Generate test page.                                        //
                //                                                            //
                //------------------------------------------------------------//

                generatePage(prnWriter,
                             pageNo,
                             pageCount,
                             indxPaperSize,
                             indxPaperType,
                             indxOrientation,
                             indxOrientRear,
                             indxPlexMode,
                             flagFrontFace,
                             flagSimplexJob,
                             flagMainForm,
                             flagRearForm,
                             flagMainOnPrnDisk,
                             flagRearOnPrnDisk,
                             flagRearBPlate,
                             flagPrintDescText,
                             formFileMain,
                             formFileRear,
                             indxMethod,
                             macroIdMain,
                             macroIdRear);

                //------------------------------------------------------------//
                //                                                            //
                // Toggle front/rear face indicator.                          //
                //                                                            //
                //------------------------------------------------------------//

                if ((!flagSimplexJob) && (!flagRearBPlate))
                {
                    flagFrontFace = !flagFrontFace;
                }
            }

            //----------------------------------------------------------------//
            //                                                                //
            // If the macro method is 'Overlay', it seems that a terminating  //
            // FormFeed character is required to trigger the (end of page)    //
            // overlay on the last page - without it, only the variable data  //
            // is printed on that page!                                       //
            //                                                                //
            //----------------------------------------------------------------//

            if (indxMethod == eMacroMethod.Overlay)
            {
                PCLWriter.formFeed(prnWriter);
            }
        }
Пример #8
0
        //--------------------------------------------------------------------//
        //                                                        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,
                                         UInt16 logXOffset)
        {
            Int16 posX,
                  posY,
                  rectX,
                  rectY,
                  rectHeight,
                  rectWidth;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            rectHeight = (Int16)(_lineInc / 2);
            rectWidth  = _lineInc;

            //----------------------------------------------------------------//
            //                                                                //
            // Set pattern transparency to Opaque so that white samples show  //
            // on the shaded background.                                      //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.patternTransparency(prnWriter,
                                          true);

            //----------------------------------------------------------------//
            //                                                                //
            // Monochrome palette.                                            //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.paletteSimple(prnWriter,
                                    PCLWriter.eSimplePalette.K);

            posX = (Int16)(_posXData - logXOffset);
            posY = _posYData;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            //----------------------------------------------------------------//
            //                                                                //
            // RGB palette.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.paletteSimple(prnWriter,
                                    PCLWriter.eSimplePalette.RGB);

            posX += _colInc;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 2);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 3);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 4);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 5);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 6);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 7);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            //----------------------------------------------------------------//
            //                                                                //
            // CMY palette.                                                   //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.paletteSimple(prnWriter,
                                    PCLWriter.eSimplePalette.CMY);

            posX += _colInc;

            rectX = posX;
            rectY = posY;

            PCLWriter.setForegroundColour(prnWriter, 0);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, true,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 1);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 2);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 3);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 4);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 5);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 6);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

            rectY += _lineInc;

            PCLWriter.setForegroundColour(prnWriter, 7);

            PCLWriter.rectangleSolid(prnWriter, rectX, rectY,
                                     rectHeight, rectWidth, false,
                                     false, false);

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

            PCLWriter.formFeed(prnWriter);
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxOrientation,
                                         Boolean formAsMacro,
                                         UInt16 logXOffset)
        {
            String lbCRTerm = "\x0d" + "~";

            Int16 posX,
                  posY;

            Int16 ptSize,
                  degrees;

            Int16 boxX,
                  boxY,
                  boxHeight,
                  boxWidth;

            Double scaleX,
                   scaleY;

            Double angle,
                   sinAngle,
                   cosAngle;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // HP-GL/2 picture frame and initialisation.                      //
            //                                                                //
            // Plotter units are always absolute at 0.025mm (1/1016 inch),    //
            // but many HP-GL/2 commands use (definable) user units.          //
            // It makes the code clearer if we use the same units in HP-GL/2  //
            // as we do in PCL, so the SC (scale) command is used to set      //
            // user-units to 600 units-per-inch.                              //
            //                                                                //
            // Note that the default HP-GL/2 Y-axis has its origin at         //
            // lower-left of the picture frame, and Y-coordinate values       //
            // increase UP the page, whilst the PCL Y-axis has its origin at  //
            // the top margin and Y-coordinate values increase DOWN the page. //
            //                                                                //
            // It is possible to use the same (600 upi) coordinates as PCL by //
            // using:                                                         //
            //  SC0,1.6933,0,-1.6933,2                                        //
            //  IR0,100,100,0                                                 //
            // Note that the IR coordinates shown in the example in the "PCL  //
            // Technical Reference" manual are different and are incorrect!   //
            // One drawback to using the same origin and axis direction is    //
            // that some commands (such as SR) then have to use negative      //
            // Y-values to avoid mirroring.                                   //
            //                                                                //
            //----------------------------------------------------------------//

            scaleX = (Double)_plotUnitsPerInch / _unitsPerInch;
            scaleY = (Double)_plotUnitsPerInch / _unitsPerInch;

            boxX      = 0;
            boxY      = 0;
            boxWidth  = (Int16)(_logPageWidth);
            boxHeight = (Int16)(_logPageHeight);

            PCLWriter.pictureFrame(prnWriter,
                                   boxX,
                                   boxY,
                                   boxHeight,
                                   boxWidth);

            PCLWriter.modeHPGL2(prnWriter, false, false);

            PCLWriter.cmdHPGL2(prnWriter, "IN", "", false);
            PCLWriter.cmdHPGL2(prnWriter, "SP", "1", true);
            PCLWriter.cmdHPGL2(prnWriter, "DT", "~", false);

            PCLWriter.cmdHPGL2(prnWriter, "SC",
                               "0," + scaleX.ToString("F4") +
                               ",0," + (-scaleY).ToString("F4") +
                               ",2",
                               false);

            PCLWriter.cmdHPGL2(prnWriter, "IR", "0,100,100,0", false);
            PCLWriter.cmdHPGL2(prnWriter, "PU", "0,0", true);

            PCLWriter.modePCL(prnWriter, true);

            //----------------------------------------------------------------//
            //                                                                //
            // Rotated text.                                                  //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 36;

            PCLWriter.font(prnWriter, true, "19U",
                           PCLFonts.getPCLFontSelect(_indxFontArial,
                                                     PCLFonts.eVariant.Regular,
                                                     ptSize, 0));

            //----------------------------------------------------------------//
            // Orthogonal text                                                //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData1 - logXOffset);
            posY = _posYData1;

            posX += _lineInc / 4;

            PCLWriter.printDirection(prnWriter, 0);

            PCLWriter.textRotated(prnWriter, posX, posY, 0, 0, true,
                                  "angle 0");

            posX -= _lineInc / 2;

            PCLWriter.textRotated(prnWriter, posX, posY, 0, 180, true,
                                  "ccw 180");

            posX += _lineInc / 4;
            posY -= _lineInc / 4;

            PCLWriter.textRotated(prnWriter, posX, posY, 0, 90, true,
                                  "ccw 90");

            posY += _lineInc / 2;

            PCLWriter.textRotated(prnWriter, posX, posY, 0, 270, true,
                                  "ccw 270");

            //----------------------------------------------------------------//
            // direction quadrants I and III                                  //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData2 - logXOffset);
            posY = _posYData2;

            PCLWriter.modeHPGL2(prnWriter, false, false);

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            degrees  = 30;
            angle    = Math.PI * degrees / 180.0;
            sinAngle = Math.Sin(angle);
            cosAngle = Math.Cos(angle);

            PCLWriter.cmdHPGL2(prnWriter, "DI",
                               cosAngle.ToString() + "," +
                               sinAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB",
                               "angle +30" + lbCRTerm, true);

            PCLWriter.cmdHPGL2(prnWriter, "DI",
                               "-" + cosAngle.ToString() + "," +
                               "-" + sinAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB",
                               "angle +210" + lbCRTerm, true);

            //----------------------------------------------------------------//
            // direction quadrants II and IV                                  //
            //----------------------------------------------------------------//

            posX = (Int16)(_posXData2 - logXOffset - ((1 * _incInch) / 4));

            PCLWriter.modeHPGL2(prnWriter, false, false);

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            degrees  = 45;
            angle    = Math.PI * degrees / 180.0;
            sinAngle = Math.Sin(angle);
            cosAngle = Math.Cos(angle);

            PCLWriter.cmdHPGL2(prnWriter, "DI",
                               "-" + cosAngle.ToString() + "," +
                               sinAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB",
                               "angle +135" + lbCRTerm, true);

            posX += ((1 * _incInch) / 2);
            posY += ((_lineInc * 1) / 6);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "DI",
                               cosAngle.ToString() + "," +
                               "-" + sinAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB",
                               "angle +315" + lbCRTerm, true);

            //----------------------------------------------------------------//
            // resets                                                         //
            //----------------------------------------------------------------//

            posX  = (Int16)(_posXData2 - logXOffset);
            posY += ((_lineInc * 1) / 2);

            PCLWriter.cmdHPGL2(prnWriter, "DI", "1,0", false);

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

            PCLWriter.formFeed(prnWriter);
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxOrientation,
                                         Boolean formAsMacro,
                                         UInt16 logXOffset,
                                         UInt32 codePoint,
                                         Int32 indxFont,
                                         PCLFonts.eVariant fontVar)
        {
            Int16 posX,
                  posY;

            Int16 ptSize;

            Byte[] utf8Seq = new Byte[4];
            Int32  utf8Len = 0;

            String utf8HexVal = "";

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Code-point data.                                               //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 18;

            PCLWriter.font(prnWriter, true, "19U",
                           PCLFonts.getPCLFontSelect(_indxFontArial,
                                                     PCLFonts.eVariant.Regular,
                                                     ptSize, 0));

            posX = (Int16)(_posXData - logXOffset);
            posY = _posYData;

            if (codePoint < 0x010000)
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "U+" +
                               codePoint.ToString("x4"));
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "U+" +
                               codePoint.ToString("x6"));
            }

            PrnParseDataUTF8.convertUTF32ToUTF8Bytes(codePoint,
                                                     ref utf8Len,
                                                     ref utf8Seq);

            PrnParseDataUTF8.convertUTF32ToUTF8HexString(codePoint,
                                                         true,
                                                         ref utf8HexVal);

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0, utf8HexVal);

            //----------------------------------------------------------------//
            //                                                                //
            // Font data.                                                     //
            //                                                                //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           PCLFonts.getName(indxFont) +
                           " " +
                           Enum.GetName(typeof(PCLFonts.eVariant), fontVar));

            posY += _lineInc;

            ptSize = 36;

            PCLWriter.font(prnWriter, true, "18N",
                           PCLFonts.getPCLFontSelect(indxFont,
                                                     fontVar,
                                                     ptSize, 0));

            PCLWriter.textParsingMethod(
                prnWriter,
                PCLTextParsingMethods.eIndex.m83_UTF8);

            PCLWriter.cursorPosition(prnWriter, posX, posY);

            prnWriter.Write(utf8Seq, 0, utf8Len);

            PCLWriter.formFeed(prnWriter);
        }
Пример #11
0
        //--------------------------------------------------------------------//
        //                                                        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 indxPlexMode,
                                         String pjlCommand,
                                         Boolean formAsMacro,
                                         Boolean customPaperSize,
                                         Boolean rearFace,
                                         UInt16 paperWidth,
                                         UInt16 paperLength,
                                         UInt16 logXOffset,
                                         Single scaleText)
        {
            const String digitsTextA = "         1         2" +
                                       "         3         4" +
                                       "         5         6" +
                                       "         7         8" +
                                       "         9        10" +
                                       "        11        12" +
                                       "        13        14" +
                                       "        15        16" +
                                       "        17        18";

            const String digitsTextB = "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890" +
                                       "12345678901234567890";

            const Double unitsToInches      = (1.00 / _sessionUPI);
            const Double unitsToMilliMetres = (25.4 / _sessionUPI);

            const Int16 bottomMargin = (Int16)(0.5 * _sessionUPI);

            Int16 squareRightX,
                  squareBottomY;

            Int16 posX,
                  posY;

            Int16 lineInc,
                  ptSize;

            Int32 ctA;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId, PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false,
                                paperWidth, paperLength, logXOffset, scaleText);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Corner squares.                                                //
            //                                                                //
            //----------------------------------------------------------------//

            squareRightX  = (Int16)(paperWidth - _boxOuterEdge - logXOffset);
            squareBottomY = (Int16)(paperLength - _boxOuterEdge);

            // Top-left.                                                      //

            posX = 0;
            posY = 0;

            generateSquare(prnWriter, posX, posY, false);

            // Top-right.                                                     //

            posX = squareRightX;
            posY = 0;

            generateSquare(prnWriter, posX, posY, false);

            // Bottom-left.                                                   //

            posX = 0;
            posY = squareBottomY;

            generateSquare(prnWriter, posX, posY, false);

            // Bottom-right.                                                  //

            posX = squareRightX;
            posY = squareBottomY;

            generateSquare(prnWriter, posX, posY, false);

            //----------------------------------------------------------------//
            //                                                                //
            // Paper description data.                                        //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize  = (Int16)(10 * scaleText);
            lineInc = (Int16)((_sessionUPI * scaleText) / 8);

            PCLWriter.font(prnWriter, true, "19U",
                           "s0p" + (120 / ptSize) + "h0s3b4099T");

            posX = (Int16)((_posXDesc + (_rulerCell * scaleText)) - logXOffset);
            posY = _posYDesc;

            if (customPaperSize)
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPaperSizes.getNameAndDesc(indxPaperSize));
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPaperSizes.getName(indxPaperSize));
            }

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           PCLPaperTypes.getName(indxPaperType));

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           PCLOrientations.getName(indxOrientation));

            posY += lineInc;

            if (rearFace)
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPlexModes.getName(indxPlexMode) +
                               ": rear face");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0,
                               PCLPlexModes.getName(indxPlexMode));
            }

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           (Math.Round((paperWidth *
                                        unitsToMilliMetres), 2)).ToString("F1") +
                           " mm = " +
                           (Math.Round((paperWidth *
                                        unitsToInches), 3)).ToString("F3") +
                           "\"");

            posY += lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           (Math.Round((paperLength *
                                        unitsToMilliMetres), 2)).ToString("F1") +
                           " mm = " +
                           (Math.Round((paperLength *
                                        unitsToInches), 3)).ToString("F3") +
                           "\"");

            posY += lineInc;

            if (pjlCommand == "")
            {
                PCLWriter.text(prnWriter, posX, posY, 0, "<none>");
            }
            else
            {
                PCLWriter.text(prnWriter, posX, posY, 0, pjlCommand);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // Fixed-pitch 10cpi text - not rotated.                          //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.font(prnWriter, true, "19U", "s0p10h0s0b4099T");

            posY = _posYText;

            ctA = (paperWidth * 10) / _sessionUPI;

            PCLWriter.text(prnWriter, 0, posY, 0, digitsTextA.Substring(0, ctA));

            posY += _rulerDiv;

            PCLWriter.text(prnWriter, 0, posY, 0, digitsTextB.Substring(0, ctA));

            //----------------------------------------------------------------//
            //                                                                //
            // Rotate print direction by 180-degrees.                         //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.printDirection(prnWriter, 180);

            //----------------------------------------------------------------//
            //                                                                //
            // Fixed-pitch 10cpi text - 180-degree rotated.                   //
            //                                                                //
            //----------------------------------------------------------------//

            posY = (Int16)(paperLength - _posYText - (2 * bottomMargin));

            ctA = (paperWidth * 10) / _sessionUPI;

            PCLWriter.text(prnWriter, 0, posY, 0, digitsTextA.Substring(0, ctA));

            posY += _rulerDiv;

            PCLWriter.text(prnWriter, 0, posY, 0, digitsTextB.Substring(0, ctA));

            //----------------------------------------------------------------//
            //                                                                //
            // Left box: rotated (180-degree) orientation.                    //
            //                                                                //
            //----------------------------------------------------------------//

            posX = squareRightX;
            posY = (Int16)(((paperLength - _boxOuterEdge) / 2) - bottomMargin);

            generateSquare(prnWriter, posX, posY, false);

            //----------------------------------------------------------------//
            //                                                                //
            // Reset print direction to 0-degrees.                            //
            //                                                                //
            //----------------------------------------------------------------//

            PCLWriter.printDirection(prnWriter, 0);

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

            PCLWriter.formFeed(prnWriter);
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e P a g e                                            //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write individual test data page sequences to output file.          //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generatePage(BinaryWriter prnWriter,
                                         Int32 indxPaperSize,
                                         Int32 indxPaperType,
                                         Int32 indxOrientation,
                                         Boolean formAsMacro,
                                         UInt16 logXOffset)
        {
            String sampleText = "0123456789";
            String lbTerm     = "~";

            Int16 posX,
                  posY;

            Int16 ptSize,
                  degrees;

            Int16 boxX,
                  boxY,
                  boxHeight,
                  boxWidth;

            Double scaleX,
                   scaleY;

            Double angle,
                   tanAngle;

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

            if (formAsMacro)
            {
                PCLWriter.macroControl(prnWriter, _macroId,
                                       PCLWriter.eMacroControl.Call);
            }
            else
            {
                generateOverlay(prnWriter, false, logXOffset,
                                indxPaperSize, indxOrientation);
            }

            //----------------------------------------------------------------//
            //                                                                //
            // HP-GL/2 picture frame and initialisation.                      //
            //                                                                //
            // Plotter units are always absolute at 0.025mm (1/1016 inch),    //
            // but many HP-GL/2 commands use (definable) user units.          //
            // It makes the code clearer if we use the same units in HP-GL/2  //
            // as we do in PCL, so the SC (scale) command is used to set      //
            // user-units to 600 units-per-inch.                              //
            //                                                                //
            // Note that the default HP-GL/2 Y-axis has its origin at         //
            // lower-left of the picture frame, and Y-coordinate values       //
            // increase UP the page, whilst the PCL Y-axis has its origin at  //
            // the top margin and Y-coordinate values increase DOWN the page. //
            //                                                                //
            // It is possible to use the same (600 upi) coordinates as PCL by //
            // using:                                                         //
            //  SC0,1.6933,0,-1.6933,2                                        //
            //  IR0,100,100,0                                                 //
            // Note that the IR coordinates shown in the example in the "PCL  //
            // Technical Reference" manual are different and are incorrect!   //
            // One drawback to using the same origin and axis direction is    //
            // that some commands (such as SR) then have to use negative      //
            // Y-values to avoid mirroring.                                   //
            //                                                                //
            //----------------------------------------------------------------//

            scaleX = (Double)_plotUnitsPerInch / _unitsPerInch;
            scaleY = (Double)_plotUnitsPerInch / _unitsPerInch;

            boxX      = 0;
            boxY      = 0;
            boxWidth  = (Int16)(_logPageWidth);
            boxHeight = (Int16)(_logPageHeight);

            PCLWriter.pictureFrame(prnWriter,
                                   boxX,
                                   boxY,
                                   boxHeight,
                                   boxWidth);

            PCLWriter.modeHPGL2(prnWriter, false, false);

            PCLWriter.cmdHPGL2(prnWriter, "IN", "", false);
            PCLWriter.cmdHPGL2(prnWriter, "SP", "1", true);
            PCLWriter.cmdHPGL2(prnWriter, "DT", "~", false);

            PCLWriter.cmdHPGL2(prnWriter, "SC",
                               "0," + scaleX.ToString("F4") +
                               ",0," + (-scaleY).ToString("F4") +
                               ",2",
                               false);

            PCLWriter.cmdHPGL2(prnWriter, "IR", "0,100,100,0", false);
            PCLWriter.cmdHPGL2(prnWriter, "PU", "0,0", true);

            PCLWriter.modePCL(prnWriter, true);

            //----------------------------------------------------------------//
            //                                                                //
            // Descriptive text.                                              //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 18;

            PCLWriter.font(prnWriter, true, "19U",
                           PCLFonts.getPCLFontSelect(_indxFontCourier,
                                                     PCLFonts.eVariant.Regular,
                                                     ptSize, 0));

            posX = (Int16)(_posXData1 - logXOffset);
            posY = _posYDesc;

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "Arial");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "+30");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "-45");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "+ve");

            posY += _lineInc;

            PCLWriter.text(prnWriter, posX, posY, 0,
                           "-ve");

            //----------------------------------------------------------------//
            //                                                                //
            // Embellished text.                                              //
            //                                                                //
            //----------------------------------------------------------------//

            ptSize = 36;

            posX = (Int16)(_posXData2 - logXOffset);
            posY = _posYData;

            //----------------------------------------------------------------//
            // standard                                                       //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.modeHPGL2(prnWriter, false, false);

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            //----------------------------------------------------------------//
            // size X                                                         //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "SR", "4,-3", true);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            PCLWriter.cmdHPGL2(prnWriter, "SR", "", true);

            //----------------------------------------------------------------//
            // size Y                                                         //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "SR", "3.2,-6", true);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            PCLWriter.cmdHPGL2(prnWriter, "SI", "", true);

            //----------------------------------------------------------------//
            // slant X positive                                               //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            degrees  = 30;
            angle    = Math.PI * degrees / 180.0;
            tanAngle = Math.Tan(angle);

            PCLWriter.cmdHPGL2(prnWriter, "SL",
                               tanAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            //----------------------------------------------------------------//
            // slant X negative                                               //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            degrees  = 45;
            angle    = Math.PI * degrees / 180.0;
            tanAngle = Math.Tan(angle);

            PCLWriter.cmdHPGL2(prnWriter, "SL",
                               "-" + tanAngle.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            PCLWriter.cmdHPGL2(prnWriter, "SL", "0", false);

            //----------------------------------------------------------------//
            // extra space X positive                                         //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "ES", ".2,0", false);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

            //----------------------------------------------------------------//
            // extra space X negative                                         //
            //----------------------------------------------------------------//

            posY += _lineInc;

            PCLWriter.cmdHPGL2(prnWriter, "SD",
                               PCLFonts.getHPGL2FontDef(_indxFontArial,
                                                        PCLFonts.eVariant.Regular,
                                                        14, ptSize, 0),
                               true);

            PCLWriter.cmdHPGL2(prnWriter, "PA",
                               posX.ToString() + "," +
                               posY.ToString(), false);

            PCLWriter.cmdHPGL2(prnWriter, "ES", "-.1,0", false);

            PCLWriter.cmdHPGL2(prnWriter, "LB", sampleText + lbTerm, true);

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

            PCLWriter.modePCL(prnWriter, true);

            PCLWriter.formFeed(prnWriter);
        }