示例#1
0
        /// <summary>
        /// Converts the given PrintTicket into Win32 DEVMODE.
        /// </summary>
        /// <param name="printTicket">MemoryStream containing the XML PrintTicket.</param>
        /// <param name="baseType">Type of default DEVMODE to use as base of conversion.</param>
        /// <param name="scope">scope that the input PrintTicket will be limited to</param>
        /// <returns>Byte buffer that contains the converted Win32 DEVMODE.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The PrintTicket specified by <paramref name="printTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to convert the PrintTicket to a DEVMODE.
        /// </exception>
        public override byte[] ConvertPrintTicketToDevMode(MemoryStream printTicket,
                                                           BaseDevModeType baseType,
                                                           PrintTicketScope scope)
        {
            VerifyAccess();

            InternalPrintTicket ticket = (printTicket != null) ? new InternalPrintTicket(printTicket) : null;

            DevMode result = GetDEVMODE(baseType);

            DevModeFields supportedFields;
            WinSpoolPrinterCapabilities capabilities = GetCapabilities(result);

            try
            {
                supportedFields = capabilities.Fields;
            }
            finally
            {
                capabilities.Release();
            }

            PrintTicketToDevMode(result, ticket, scope, supportedFields);

            return(result.ByteData);
        }
示例#2
0
        /// <summary>
        /// Merges delta PrintTicket with base PrintTicket and then validates the merged PrintTicket.
        /// </summary>
        /// <param name="basePrintTicket">The MemoryStream that contains base XML PrintTicket.</param>
        /// <param name="deltaPrintTicket">The MemoryStream that contains delta XML PrintTicket.</param>
        /// <param name="scope">scope that delta PrintTicket and result PrintTicket will be limited to</param>
        /// <param name="conflictStatus">The returned conflict resolving status.</param>
        /// <returns>MemoryStream that contains validated and merged PrintTicket XML.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The base PrintTicket specified by <paramref name="basePrintTicket"/> is not well-formed,
        /// or delta PrintTicket specified by <paramref name="deltaPrintTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to merge and validate the input PrintTicket(s).
        /// </exception>
        public override MemoryStream MergeAndValidatePrintTicket(MemoryStream basePrintTicket,
                                                                 MemoryStream deltaPrintTicket,
                                                                 PrintTicketScope scope,
                                                                 out ConflictStatus conflictStatus)
        {
            VerifyAccess();

            DevModeFields supportedFields = DevModeFields.All;
            DevMode       defaultDevMode  = GetDEVMODE(BaseDevModeType.PrinterDefault);

            InternalPrintTicket baseTicket  = (basePrintTicket != null) ? new InternalPrintTicket(basePrintTicket) : null;
            DevMode             baseDevMode = defaultDevMode.Clone();

            PrintTicketToDevMode(baseDevMode, baseTicket, scope, supportedFields);

            InternalPrintTicket deltaTicket  = (deltaPrintTicket != null) ? new InternalPrintTicket(deltaPrintTicket) : null;
            DevMode             deltaDevMode = defaultDevMode.Clone();

            PrintTicketToDevMode(deltaDevMode, deltaTicket, scope, supportedFields);

            // DevMode Merge - Copy fields set in baseDevMode but not set in deltaDevMode
            deltaDevMode.Copy(baseDevMode, baseDevMode.Fields & (~deltaDevMode.Fields));

            conflictStatus = Validate(deltaDevMode) ? ConflictStatus.NoConflict : ConflictStatus.ConflictResolved;

            InternalPrintTicket validatedTicket = DevModeToPrintTicket(deltaDevMode, scope, supportedFields);

            return(validatedTicket.XmlStream);
        }
        internal static byte[] InternalConvertPrintTicketToDevMode(PTProviderBase provider,
                                                                   PrintTicket printTicket,
                                                                   BaseDevModeType baseType,
                                                                   PrintTicketScope scope)
        {
            // Input PrinTicket can't be null.
            if (printTicket == null)
            {
                throw new ArgumentNullException(nameof(printTicket));
            }

            // Validate the base type value.
            if ((baseType != BaseDevModeType.UserDefault) &&
                (baseType != BaseDevModeType.PrinterDefault))
            {
                throw new ArgumentOutOfRangeException(nameof(baseType));
            }

            // Validate scope value.
            if ((scope != PrintTicketScope.PageScope) &&
                (scope != PrintTicketScope.DocumentScope) &&
                (scope != PrintTicketScope.JobScope))
            {
                throw new ArgumentOutOfRangeException(nameof(scope));
            }

            MemoryStream ptStream = printTicket.GetXmlStream();

            return(provider.ConvertPrintTicketToDevMode(ptStream, baseType, scope));
        }
示例#4
0
        private InternalPrintTicket DevModeToPrintTicket(DevMode devmode, PrintTicketScope scope, DevModeFields supportedFields)
        {
            InternalPrintTicket resultTicket = new InternalPrintTicket();

            PrintSchemaShim.TryEmbedDevMode(resultTicket, this.OemDriverNamespace, devmode);
            PrintSchemaShim.CopyDevModeToTicket(resultTicket, devmode, scope, supportedFields);
            return(resultTicket);
        }
示例#5
0
        /// <summary>
        /// Converts the given Win32 DEVMODE into PrintTicket.
        /// </summary>
        /// <param name="devMode">Byte buffer containing the Win32 DEVMODE.</param>
        /// <param name="scope">scope that the result PrintTicket will be limited to</param>
        /// <returns>MemoryStream that contains the converted XML PrintTicket.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The DEVMODE specified by <paramref name="devMode"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to convert the DEVMODE to a PrintTicket.
        /// </exception>
        public override MemoryStream ConvertDevModeToPrintTicket(byte[] devMode, PrintTicketScope scope)
        {
            VerifyAccess();

            if (devMode == null)
            {
                throw new ArgumentNullException("devMode");
            }

            InternalPrintTicket result = DevModeToPrintTicket(new DevMode(devMode), scope, DevModeFields.All);

            return(result.XmlStream);
        }
        /// <summary>
        /// Converts the given Win32 DEVMODE into PrintTicket.
        /// </summary>
        /// <param name="devMode">Byte buffer containing the Win32 DEVMODE.</param>
        /// <param name="scope">scope that the result PrintTicket will be limited to</param>
        /// <returns>The converted PrintTicket object.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PrintTicketConverter instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="devMode"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="scope"/> parameter is not one of the standard <see cref="PrintTicketScope"/> values.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The DEVMODE specified by <paramref name="devMode"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PrintTicketConverter instance failed to convert the DEVMODE to a PrintTicket.
        /// </exception>
        public PrintTicket ConvertDevModeToPrintTicket(byte[]           devMode,
                                                       PrintTicketScope scope)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("PrintTicketConverter");
            }

            //Check to insure that the PrintTicketConverter is being called from the same thread that instantiated it
            VerifyAccess();

            return(InternalConvertDevModeToPrintTicket(_ptProvider, devMode, scope));
        }
        /// <summary>
        /// Converts the given PrintTicket into Win32 DEVMODE.
        /// </summary>
        /// <param name="printTicket">The PrintTicket to be converted.</param>
        /// <param name="baseType">Type of default DEVMODE to use as base of conversion.</param>
        /// <param name="scope">scope that the input PrintTicket will be limited to</param>
        /// <returns>Byte buffer that contains the converted Win32 DEVMODE.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PrintTicketConverter instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="printTicket"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="baseType"/> parameter is not one of the standard <see cref="BaseDevModeType"/> values.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="scope"/> parameter is not one of the standard <see cref="PrintTicketScope"/> values.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The PrintTicket specified by <paramref name="printTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PrintTicketConverter instance failed to convert the PrintTicket to a DEVMODE.
        /// </exception>
        public byte[] ConvertPrintTicketToDevMode(PrintTicket printTicket,
                                                  BaseDevModeType baseType,
                                                  PrintTicketScope scope)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("PrintTicketConverter");
            }

            //Check to insure that the PrintTicketConverter is being called from the same thread that instantiated it
            VerifyAccess();

            return(InternalConvertPrintTicketToDevMode(_ptProvider, printTicket, baseType, scope));
        }
示例#8
0
        /// <summary>
        /// Converts the given Win32 DEVMODE into PrintTicket.
        /// </summary>
        /// <param name="devMode">Byte buffer containing the Win32 DEVMODE.</param>
        /// <param name="scope">scope that the result PrintTicket will be limited to</param>
        /// <returns>MemoryStream that contains the converted XML PrintTicket.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The DEVMODE specified by <paramref name="devMode"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to convert the DEVMODE to a PrintTicket.
        /// </exception>
        /// <exception cref="PrintingNotSupportedException">
        /// Printing components are not installed on the client
        /// </exception>
        public override MemoryStream ConvertDevModeToPrintTicket(byte[] devMode,
                                                                 PrintTicketScope scope)
        {
            VerifyAccess();

            IntPtr umDevMode = Marshal.AllocCoTaskMem(devMode.Length);

            try
            {
                // Allocate unmanaged buffer and copy devMode byte array into the unmanaged buffer
                Marshal.Copy(devMode, 0, umDevMode, devMode.Length);

                IStream printTicketStream = CreateStreamOnHGlobal();
                try
                {
                    uint hResult = UnsafeNativeMethods.PTConvertDevModeToPrintTicket(_providerHandle,
                                                                                     (uint)devMode.Length,
                                                                                     new HandleRef(this, umDevMode),
                                                                                     (uint)scope,
                                                                                     printTicketStream);

                    if (PTUtility.IsSuccessCode(hResult))
                    {
                        RewindIStream(printTicketStream);
                        return(MemoryStreamFromIStream(printTicketStream));
                    }

                    throw new PrintQueueException((int)hResult,
                                                  "PrintConfig.Provider.DevMode2PTFail",
                                                  _deviceName);
                }
                finally
                {
                    DeleteIStream(ref printTicketStream);
                }
            }
            finally
            {
                if (umDevMode != IntPtr.Zero)
                {
                    Marshal.FreeCoTaskMem(umDevMode);
                    umDevMode = IntPtr.Zero;
                }
            }
        }
示例#9
0
        /// <summary>
        /// Merges delta PrintTicket with base PrintTicket and then validates the merged PrintTicket.
        /// </summary>
        /// <param name="basePrintTicket">The base PrintTicket.</param>
        /// <param name="deltaPrintTicket">The delta PrintTicket.</param>
        /// <param name="scope">scope that delta PrintTicket and result PrintTicket will be limited to</param>
        /// <returns>Struct that contains PrintTicket validation result info.</returns>
        /// <remarks>
        /// The <paramref name="deltaPrintTicket"/> parameter could be null, in which case
        /// only validation will be performed on <paramref name="basePrintTicket"/>.
        /// </remarks>
        /// <exception cref="ObjectDisposedException">
        /// The PrintTicketManager instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="basePrintTicket"/> parameter is null.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// The <paramref name="scope"/> parameter is not one of the standard <see cref="PrintTicketScope"/> values.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The base PrintTicket specified by <paramref name="basePrintTicket"/> is not well-formed,
        /// or delta PrintTicket specified by <paramref name="deltaPrintTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PrintTicketManager instance failed to merge and validate the input PrintTicket(s).
        /// </exception>
        public ValidationResult MergeAndValidatePrintTicket(PrintTicket basePrintTicket,
                                                            PrintTicket deltaPrintTicket,
                                                            PrintTicketScope scope)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("PrintTicketManager");
            }

            // Base PrintTicket is required. Delta PrintTicket is optional.
            if (basePrintTicket == null)
            {
                throw new ArgumentNullException("basePrintTicket");
            }

            // validate scope value
            if ((scope != PrintTicketScope.PageScope) &&
                (scope != PrintTicketScope.DocumentScope) &&
                (scope != PrintTicketScope.JobScope))
            {
                throw new ArgumentOutOfRangeException("scope");
            }

            MemoryStream   baseStream = null, deltaStream = null, resultStream = null;
            ConflictStatus status;

            baseStream = basePrintTicket.GetXmlStream();

            if (deltaPrintTicket != null)
            {
                deltaStream = deltaPrintTicket.GetXmlStream();
            }

            resultStream = _ptProvider.MergeAndValidatePrintTicket(baseStream,
                                                                   deltaStream,
                                                                   scope,
                                                                   out status);

            return(new ValidationResult(resultStream, status));
        }
        internal static PrintTicket InternalConvertDevModeToPrintTicket(PTProviderBase provider,
                                                                        byte[] devMode,
                                                                        PrintTicketScope scope)
        {
            // validate devMode parameter
            if (devMode == null)
            {
                throw new ArgumentNullException(nameof(devMode));
            }

            // validate sope parameter
            if ((scope != PrintTicketScope.PageScope) &&
                (scope != PrintTicketScope.DocumentScope) &&
                (scope != PrintTicketScope.JobScope))
            {
                throw new ArgumentOutOfRangeException(nameof(scope));
            }

            MemoryStream ptStream = provider.ConvertDevModeToPrintTicket(devMode, scope);

            return(new PrintTicket(ptStream));
        }
示例#11
0
 /// <summary>
 /// Converts the given Win32 DEVMODE into PrintTicket.
 /// </summary>
 /// <param name="devMode">Byte buffer containing the Win32 DEVMODE.</param>
 /// <param name="scope">scope that the result PrintTicket will be limited to</param>
 /// <returns>MemoryStream that contains the converted XML PrintTicket.</returns>
 public abstract MemoryStream ConvertDevModeToPrintTicket(byte[] devMode, PrintTicketScope scope);
示例#12
0
 /// <summary>
 /// Merges delta PrintTicket with base PrintTicket and then validates the merged PrintTicket.
 /// </summary>
 /// <param name="basePrintTicket">The MemoryStream that contains base XML PrintTicket.</param>
 /// <param name="deltaPrintTicket">The MemoryStream that contains delta XML PrintTicket.</param>
 /// <param name="scope">scope that delta PrintTicket and result PrintTicket will be limited to</param>
 /// <param name="conflictStatus">The returned conflict resolving status.</param>
 /// <returns>MemoryStream that contains validated and merged PrintTicket XML.</returns>
 public abstract MemoryStream MergeAndValidatePrintTicket(MemoryStream basePrintTicket,
                                                          MemoryStream deltaPrintTicket,
                                                          PrintTicketScope scope,
                                                          out ConflictStatus conflictStatus);
示例#13
0
 /// <summary>
 /// Converts the given PrintTicket into Win32 DEVMODE.
 /// </summary>
 /// <param name="printTicket">MemoryStream containing the XML PrintTicket.</param>
 /// <param name="baseType">Type of default DEVMODE to use as base of conversion.</param>
 /// <param name="scope">scope that the input PrintTicket will be limited to</param>
 /// <returns>Byte buffer that contains the converted Win32 DEVMODE.</returns>
 public abstract byte[] ConvertPrintTicketToDevMode(MemoryStream printTicket, BaseDevModeType baseType, PrintTicketScope scope);
示例#14
0
        /// <summary>
        /// Converts the given PrintTicket into Win32 DEVMODE.
        /// </summary>
        /// <param name="printTicket">MemoryStream containing the XML PrintTicket.</param>
        /// <param name="baseType">Type of default DEVMODE to use as base of conversion.</param>
        /// <param name="scope">scope that the input PrintTicket will be limited to</param>
        /// <returns>Byte buffer that contains the converted Win32 DEVMODE.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The PrintTicket specified by <paramref name="printTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to convert the PrintTicket to a DEVMODE.
        /// </exception>
        /// <exception cref="PrintingNotSupportedException">
        /// Printing components are not installed on the client
        /// </exception>
        public override byte[] ConvertPrintTicketToDevMode(MemoryStream printTicket,
                                                           BaseDevModeType baseType,
                                                           PrintTicketScope scope)
        {
            VerifyAccess();

            uint   hResult  = 0;
            string errorMsg = null;

            IntPtr umDevMode = IntPtr.Zero;

            try
            {
                IStream printTicketStream = IStreamFromMemoryStream(printTicket);
                try
                {
                    uint umDevModeLen = 0;
                    hResult = UnsafeNativeMethods.PTConvertPrintTicketToDevMode(_providerHandle,
                                                                                printTicketStream,
                                                                                (uint)baseType,
                                                                                (uint)scope,
                                                                                out umDevModeLen,
                                                                                out umDevMode,
                                                                                out errorMsg);

                    if (PTUtility.IsSuccessCode(hResult))
                    {
                        byte[] devMode = new byte[umDevModeLen];
                        Marshal.Copy(umDevMode, devMode, 0, (int)umDevModeLen);
                        return(devMode);
                    }
                }
                finally
                {
                    DeleteIStream(ref printTicketStream);
                }
            }
            finally
            {
                if (umDevMode != IntPtr.Zero)
                {
                    UnsafeNativeMethods.PTReleaseMemory(new HandleRef(this, umDevMode));
                    umDevMode = IntPtr.Zero;
                }
            }

            if ((hResult == (uint)NativeErrorCode.E_XML_INVALID) ||
                (hResult == (uint)NativeErrorCode.E_PRINTTICKET_FORMAT))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                                          "{0} {1} {2}",
                                                          PrintSchemaTags.Framework.PrintTicketRoot,
                                                          PTUtility.GetTextFromResource("FormatException.XMLNotWellFormed"),
                                                          errorMsg),
                                            "printTicket");
            }

            throw new PrintQueueException((int)hResult,
                                          "PrintConfig.Provider.PT2DevModeFail",
                                          _deviceName,
                                          errorMsg);
        }
示例#15
0
        /// <summary>
        /// Merges delta PrintTicket with base PrintTicket and then validates the merged PrintTicket.
        /// </summary>
        /// <param name="basePrintTicket">The MemoryStream that contains base XML PrintTicket.</param>
        /// <param name="deltaPrintTicket">The MemoryStream that contains delta XML PrintTicket.</param>
        /// <param name="scope">scope that delta PrintTicket and result PrintTicket will be limited to</param>
        /// <param name="conflictStatus">The returned conflict resolving status.</param>
        /// <returns>MemoryStream that contains validated and merged PrintTicket XML.</returns>
        /// <exception cref="ObjectDisposedException">
        /// The PTProvider instance has already been disposed.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The base PrintTicket specified by <paramref name="basePrintTicket"/> is not well-formed,
        /// or delta PrintTicket specified by <paramref name="deltaPrintTicket"/> is not well-formed.
        /// </exception>
        /// <exception cref="PrintQueueException">
        /// The PTProvider instance failed to merge and validate the input PrintTicket(s).
        /// </exception>
        /// <exception cref="PrintingNotSupportedException">
        /// Printing components are not installed on the client
        /// </exception>
        public override MemoryStream MergeAndValidatePrintTicket(MemoryStream basePrintTicket,
                                                                 MemoryStream deltaPrintTicket,
                                                                 PrintTicketScope scope,
                                                                 out ConflictStatus conflictStatus)
        {
            VerifyAccess();

            conflictStatus = ConflictStatus.NoConflict;

            IStream validatedPrintTicketStream = CreateStreamOnHGlobal();

            try
            {
                IStream baseTicketStream = IStreamFromMemoryStream(basePrintTicket);
                try
                {
                    IStream deltaTicketStream = IStreamFromMemoryStream(deltaPrintTicket);
                    try
                    {
                        string errorMsg;
                        uint   hResult = UnsafeNativeMethods.PTMergeAndValidatePrintTicket(_providerHandle,
                                                                                           baseTicketStream,
                                                                                           deltaTicketStream,
                                                                                           (uint)scope,
                                                                                           validatedPrintTicketStream,
                                                                                           out errorMsg);

                        if (PTUtility.IsSuccessCode(hResult))
                        {
                            // convert the success hResult to an enum value
                            switch (hResult)
                            {
                            case (uint)NativeErrorCode.S_PT_CONFLICT_RESOLVED:
                            {
                                conflictStatus = ConflictStatus.ConflictResolved;
                                break;
                            }

                            case (uint)NativeErrorCode.S_PT_NO_CONFLICT:
                            {
                                conflictStatus = ConflictStatus.NoConflict;
                                break;
                            }

                            default:
                            {
                                throw new PrintQueueException((int)hResult,
                                                              "PrintConfig.Provider.MergeValidateFail",
                                                              _deviceName);
                            }
                            }

                            RewindIStream(validatedPrintTicketStream);

                            return(MemoryStreamFromIStream(validatedPrintTicketStream));
                        }

                        if ((hResult == (uint)NativeErrorCode.E_PRINTTICKET_FORMAT) ||
                            (hResult == (uint)NativeErrorCode.E_DELTA_PRINTTICKET_FORMAT))
                        {
                            throw new ArgumentException(String.Format(CultureInfo.CurrentCulture,
                                                                      "{0} {1} {2}",
                                                                      PrintSchemaTags.Framework.PrintTicketRoot,
                                                                      PTUtility.GetTextFromResource("FormatException.XMLNotWellFormed"),
                                                                      errorMsg),
                                                        (hResult == (uint)NativeErrorCode.E_PRINTTICKET_FORMAT) ? "basePrintTicket" : "deltaPrintTicket");
                        }
                        else
                        {
                            throw new PrintQueueException((int)hResult,
                                                          "PrintConfig.Provider.MergeValidateFail",
                                                          _deviceName,
                                                          errorMsg);
                        }
                    }
                    finally
                    {
                        DeleteIStream(ref deltaTicketStream);
                    }
                }
                finally
                {
                    DeleteIStream(ref baseTicketStream);
                }
            }
            finally
            {
                DeleteIStream(ref validatedPrintTicketStream);
            }
        }
示例#16
0
        private void PrintTicketToDevMode(DevMode devMode, InternalPrintTicket ticket, PrintTicketScope scope, DevModeFields supportedFields)
        {
            if (ticket != null)
            {
                // Apply the DEVMODE snapshot from the print ticket to our starting DEVMODE, if supported.
                DevMode ticketDevMode = PrintSchemaShim.TryGetEmbeddedDevMode(ticket, this.OemDriverNamespace);
                if (ticketDevMode != null)
                {
                    devMode.CompatibleCopy(ticketDevMode);
                }

                PrintSchemaShim.CopyTicketToDevMode(devMode, ticket, scope, supportedFields);
            }
        }