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;
// }
}