예제 #1
0
        public short ReadPrintOnBothSides(FileManifest fileManifest)
        {
            short iPrintOnBothSides = 0;            //Default value.

            if (fileManifest != null && fileManifest.DuplexMode >= 0)
            {
                iPrintOnBothSides = fileManifest.DuplexMode;
            }
            else
            {
                RegistryKey rkBase = null;
                try
                {
                    string strPrintOnBothSides;
                    rkBase = Registry.LocalMachine.OpenSubKey(REMOTE_PRINTING_REG_KEY);
                    if (rkBase != null)
                    {
                        strPrintOnBothSides = (String)rkBase.GetValue("PrintOnBothSides");
                        if (strPrintOnBothSides != null)
                        {
                            iPrintOnBothSides = Convert.ToInt16(strPrintOnBothSides);
                        }
                    }
                }
                finally
                {
                    if (rkBase != null)
                    {
                        rkBase.Close();
                    }
                }
            }

            return(iPrintOnBothSides);
        }
예제 #2
0
        // Find out the name of the printer we are going to use. We pass this into CPAT, which sets
        // USER.Default\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\device
        // Doing it this way round we know we have control over the printer used rather than relying on
        // the above key which could be blatted by any other bit of software on the system.
        public string ReadPrinterName(FileManifest fileManifest)
        {
            string strPrinterName;

            if (fileManifest != null && string.IsNullOrEmpty(fileManifest.PrinterName) == false)
            {
                strPrinterName = fileManifest.PrinterName;
            }
            else
            {
                strPrinterName = ReadMeticulusPrinterName();

                if (!IsPrinterInitialized(strPrinterName))
                {
                    // If we can't use the meticulus printer at least have a go at using the default.
                    strPrinterName = ReadSystemPrinterName();
                }
            }

            return(strPrinterName != null ? strPrinterName : "");
        }