Exemple #1
0
 private static extern uint PTMergeAndValidatePrintTicketImpl(
     SafePTProviderHandle handle,
     IStream baseTicket,
     IStream deltaTicket,
     uint scope,
     IStream resultTicket,
     [MarshalAs(UnmanagedType.BStr)] out string errorMsg);
Exemple #2
0
        /// <summary>
        /// Binds proxy to the specified printer device
        /// </summary>
        /// <param name="deviceName">printer device name</param>
        /// <param name="maxVersion">max schema version supported by client</param>
        /// <param name="prefVersion">schema version preferred by client</param>
        /// <param name="handle">device handle proxy is bound to</param>
        /// <param name="usedVersion">schema version proxy will use</param>
        /// <returns>HRESULT code</returns>
        /// <exception cref="PrintingNotSupportedException">
        /// Printing components are not installed on the client
        /// </exception>
        public static uint PTOpenProviderEx(
            string deviceName,
            int maxVersion,
            int prefVersion,
            out SafePTProviderHandle handle,
            out int usedVersion)
        {
            try {
                uint result = PTOpenProviderExImpl(deviceName, maxVersion, prefVersion, out handle, out usedVersion);
                if (result != 0)
                {
                    if (handle != null && !handle.IsInvalid)
                    {
                        handle.Dispose();
                        handle = null;
                    }
                }

                return(result);
            }
            catch (DllNotFoundException e)
            {
                throw new PrintingNotSupportedException(String.Empty, e);
            }
        }
Exemple #3
0
 private static extern uint PTConvertDevModeToPrintTicketImpl(
     SafePTProviderHandle handle,
     uint dmSize,
     HandleRef devMode,
     uint scope,
     IStream printTicket
     );
Exemple #4
0
 /// <summary>
 /// Converts the given PrintTicket into Win32 DEVMODE
 /// </summary>
 /// <param name="handle">device handle</param>
 /// <param name="printTicket">Stream that contains 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>
 /// <param name="devMode">buffer that contains the converted Win32 DEVMODE</param>
 /// <param name="dmSize">size of devMode buffer in bytes</param>
 /// <param name="errorMsg">error message if the operation failed</param>
 /// <returns>HRESULT code</returns>
 /// <exception cref="PrintingNotSupportedException">
 /// Printing components are not installed on the client
 /// </exception>
 public static uint PTConvertPrintTicketToDevMode(
     SafePTProviderHandle handle,
     IStream printTicket,
     uint baseType,
     uint scope,
     out uint dmSize,
     out IntPtr devMode,
     out string errorMsg)
 {
     try
     {
         return(PTConvertPrintTicketToDevModeImpl(
                    handle,
                    printTicket,
                    baseType,
                    scope,
                    out dmSize,
                    out devMode,
                    out errorMsg
                    ));
     }
     catch (DllNotFoundException e)
     {
         throw new PrintingNotSupportedException(String.Empty, e);
     }
 }
Exemple #5
0
 private static extern uint PTConvertPrintTicketToDevModeImpl(
     SafePTProviderHandle handle,
     IStream printTicket,
     uint baseType,
     uint scope,
     out uint dmSize,
     out IntPtr devMode,
     [MarshalAs(UnmanagedType.BStr)] out string errorMsg);
Exemple #6
0
 /// <summary>
 /// Gets the PrintCapabilities relative to the given PrintTicket
 /// </summary>
 /// <param name="handle">device handle</param>
 /// <param name="printTicket">Stream that contains XML PrintTicket</param>
 /// <param name="printCapabilities">Stream that XML PrintCapabilities will be written to</param>
 /// <param name="errorMsg">error message if the operation failed</param>
 /// <returns>HRESULT code</returns>
 /// <exception cref="PrintingNotSupportedException">
 /// Printing components are not installed on the client
 /// </exception>
 public static uint PTGetPrintCapabilities(
     SafePTProviderHandle handle,
     IStream printTicket,
     IStream printCapabilities,
     out string errorMsg)
 {
     try
     {
         return(PTGetPrintCapabilitiesImpl(handle, printTicket, printCapabilities, out errorMsg));
     }
     catch (DllNotFoundException e)
     {
         throw new PrintingNotSupportedException(String.Empty, e);
     }
 }
Exemple #7
0
 /// <summary>
 /// Converts the given Win32 DEVMODE into PrintTicket
 /// </summary>
 /// <param name="handle">device handle</param>
 /// <param name="devMode">buffer that contains the Win32 DEVMODE</param>
 /// <param name="dmSize">size of devMode buffer in bytes</param>
 /// <param name="scope">scope that the result PrintTicket will be limited to</param>
 /// <param name="printTicket">Stream that the converted XML PrintTicket will be written to</param>
 /// <returns>HRESULT code</returns>
 /// <exception cref="PrintingNotSupportedException">
 /// Printing components are not installed on the client
 /// </exception>
 public static uint PTConvertDevModeToPrintTicket(
     SafePTProviderHandle handle,
     uint dmSize,
     HandleRef devMode,
     uint scope,
     IStream printTicket)
 {
     try
     {
         return(PTConvertDevModeToPrintTicketImpl(
                    handle,
                    dmSize,
                    devMode,
                    scope,
                    printTicket
                    ));
     }
     catch (DllNotFoundException e)
     {
         throw new PrintingNotSupportedException(String.Empty, e);
     }
 }
Exemple #8
0
 /// <summary>
 /// Merges delta PrintTicket onto base PrintTicket and then validates the merged PrintTicket
 /// </summary>
 /// <param name="handle">device handle</param>
 /// <param name="baseTicket">Stream that contains base XML PrintTicket</param>
 /// <param name="deltaTicket">Stream that contains delta XML PrintTicket</param>
 /// <param name="scope">scope that delta PrintTicket and result PrintTicket will be limited to</param>
 /// <param name="resultTicket">Stream the validated XML PrintTicket it written to</param>
 /// <param name="errorMsg">error message if the operation failed</param>
 /// <returns>HRESULT code</returns>
 /// <exception cref="PrintingNotSupportedException">
 /// Printing components are not installed on the client
 /// </exception>
 public static uint PTMergeAndValidatePrintTicket(
     SafePTProviderHandle handle,
     IStream baseTicket,
     IStream deltaTicket,
     uint scope,
     IStream resultTicket,
     out string errorMsg)
 {
     try
     {
         return(PTMergeAndValidatePrintTicketImpl(
                    handle,
                    baseTicket,
                    deltaTicket,
                    scope,
                    resultTicket,
                    out errorMsg
                    ));
     }
     catch (DllNotFoundException e)
     {
         throw new PrintingNotSupportedException(String.Empty, e);
     }
 }
Exemple #9
0
 private static extern uint PTGetPrintCapabilitiesImpl(
     SafePTProviderHandle handle,
     IStream printTicket,
     IStream printCapabilities,
     [MarshalAs(UnmanagedType.BStr)] out string errorMsg);
Exemple #10
0
 private static extern uint PTOpenProviderExImpl(
     [MarshalAs(UnmanagedType.LPWStr)] string deviceName,
     int maxVersion,
     int prefVersion,
     out SafePTProviderHandle handle,
     out int usedVersion);