Пример #1
0
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // g e n e r a t e J o b H e a d e r                                  //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Write stream initialisation sequences to output file.              //
        //                                                                    //
        //--------------------------------------------------------------------//

        private static void generateJobHeader(
            BinaryWriter prnWriter,
            Int32 indxPaperSize,
            Int32 indxPaperType,
            Int32 indxOrientation,
            Int32 indxPlexMode,
            Boolean flagSimplexJob,
            Boolean flagMainEncapsulated,
            Boolean flagRearEncapsulated,
            Boolean flagMacroRemove,
            Boolean flagMainForm,
            Boolean flagRearForm,
            Boolean flagMainOnPrnDisk,
            Boolean flagRearOnPrnDisk,
            String formFileMain,
            String formFileRear,
            eMacroMethod indxMethod,
            Int32 macroIdMain,
            Int32 macroIdRear)
        {
            PCLWriter.stdJobHeader(prnWriter, "");

            if (flagMainForm)
            {
                //------------------------------------------------------------//
                //                                                            //
                // Main (or only) form in use.                                //
                //                                                            //
                //------------------------------------------------------------//

                if (flagMainOnPrnDisk)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Associate macro identifier with specified file held on //
                    // printer hard disk.                                     //
                    //                                                        //
                    // Make macro 'permanent' if remove flag not specified.   //
                    // Note that this doesn't appear to work with identifiers //
                    // associated with printer disk files, but we'll leave it //
                    // in anyway, in case it works on some devices.           //
                    //                                                        //
                    //--------------------------------------------------------//

                    PCLWriter.macroFileIdAssociate(prnWriter,
                                                   (UInt16)macroIdMain,
                                                   formFileMain);

                    if (!flagMacroRemove)
                    {
                        PCLWriter.macroControl(
                            prnWriter,
                            (Int16)macroIdMain,
                            PCLWriter.eMacroControl.MakePermanent);
                    }
                }
                else
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Download contents of specified file.                   //
                    //                                                        //
                    //--------------------------------------------------------//

                    if (!flagMainEncapsulated)
                    {
                        PCLWriter.macroControl(prnWriter,
                                               (Int16)macroIdMain,
                                               PCLWriter.eMacroControl.StartDef);
                    }

                    PCLDownloadMacro.macroFileCopy(prnWriter, formFileMain);

                    if (!flagMainEncapsulated)
                    {
                        PCLWriter.macroControl(prnWriter,
                                               (Int16)macroIdMain,
                                               PCLWriter.eMacroControl.StopDef);
                    }

                    if (!flagMacroRemove)
                    {
                        PCLWriter.macroControl(
                            prnWriter,
                            (Int16)macroIdMain,
                            PCLWriter.eMacroControl.MakePermanent);
                    }
                }
            }

            if (!flagSimplexJob)
            {
                if (flagRearForm)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Rear form in use.                                      //
                    //                                                        //
                    //--------------------------------------------------------//

                    if (flagRearOnPrnDisk)
                    {
                        //----------------------------------------------------//
                        //                                                    //
                        // Associate macro identifier with specified file     //
                        // held on printer hard disk.                         //
                        //                                                    //
                        // Make macro 'permanent' if remove flag not          //
                        // specified.                                         //
                        // Note that this doesn't appear to work with         //
                        // identifiers associated with printer disk files,    //
                        // but we'll leave it in anyway, in case it works on  //
                        // some devices.                                      //
                        //                                                    //
                        //----------------------------------------------------//

                        PCLWriter.macroFileIdAssociate(prnWriter,
                                                       (UInt16)macroIdRear,
                                                       formFileRear);

                        if (!flagMacroRemove)
                        {
                            PCLWriter.macroControl(
                                prnWriter,
                                (Int16)macroIdRear,
                                PCLWriter.eMacroControl.MakePermanent);
                        }
                    }
                    else
                    {
                        //----------------------------------------------------//
                        //                                                    //
                        // Download contents of specified file.               //
                        //                                                    //
                        //----------------------------------------------------//

                        if (!flagRearEncapsulated)
                        {
                            PCLWriter.macroControl(
                                prnWriter,
                                (Int16)macroIdRear,
                                PCLWriter.eMacroControl.StartDef);
                        }

                        PCLDownloadMacro.macroFileCopy(prnWriter, formFileRear);

                        if (!flagRearEncapsulated)
                        {
                            PCLWriter.macroControl(
                                prnWriter,
                                (Int16)macroIdRear,
                                PCLWriter.eMacroControl.StopDef);
                        }

                        if (!flagMacroRemove)
                        {
                            PCLWriter.macroControl(
                                prnWriter,
                                (Int16)macroIdRear,
                                PCLWriter.eMacroControl.MakePermanent);
                        }
                    }
                }
            }
        }