Beispiel #1
0
        private static void CopyJob(Stream stream, IXpsPrintJob job, IXpsPrintJobStream jobStream)
        {
            //            try
            //            {
            byte[] buff = new byte[4096];
            while (true)
            {
                uint read = (uint)stream.Read(buff, 0, buff.Length);
                if (read == 0)
                {
                    break;
                }

                uint written;
                jobStream.Write(buff, read, out written);

                if (read != written)
                {
                    throw new Exception("Failed to copy data to the print job stream.");
                }
            }

            // Indicate that the entire document has been copied.
            jobStream.Close();
            //            }
            //            catch (Exception)
            //            {
            //                // Cancel the job if we had any trouble submitting it.
            //                job.Cancel();
            //                throw;
            //            }
        }
Beispiel #2
0
        private static void CopyJob(Stream stream, IXpsPrintJob job, IXpsPrintJobStream jobStream)
        {
            try
            {
                byte[] buff = new byte[4096];
                while (true)
                {
                    uint read = (uint)stream.Read(buff, 0, buff.Length);
                    if (read == 0)
                    {
                        break;
                    }

                    uint written;
                    jobStream.Write(buff, read, out written);

                    if (read != written)
                    {
                        throw new Exception("Failed to copy data to the print job stream.");
                    }
                }


                jobStream.Close();
            }
            catch (Exception)
            {
                job.Cancel();
                throw;
            }
        }
Beispiel #3
0
        private static void CopyJob(Stream stream, IXpsPrintJobStream jobStream)
        {
            byte[] buff = new byte[4096];
            while (true)
            {
                uint read = (uint)stream.Read(buff, 0, buff.Length);
                if (read == 0)
                {
                    break;
                }

                jobStream.Write(buff, read, out uint written);

                if (read != written)
                {
                    throw new Exception("Failed to copy data to the print job stream.");
                }
            }

            // Indicate that the entire document has been copied.
            jobStream.Close();
        }
        private static void CopyJob(Stream stream, IXpsPrintJob job, IXpsPrintJobStream jobStream)
        {
            try
            {
                byte[] buff = new byte[4096];
                while (true)
                {
                    uint read = (uint)stream.Read(buff, 0, buff.Length);
                    if (read == 0)
                        break;

                    uint written;
                    jobStream.Write(buff, read, out written);

                    if (read != written)
                        throw new Exception("Failed to copy data to the print job stream.");
                }

                // Indicate that the entire document has been copied.
                jobStream.Close();
            }
            catch (Exception)
            {
                // Cancel the job if we had any trouble submitting it.
                job.Cancel();
                throw;
            }
        }