我已经问了过去的类似问题,但自那时起就没有快乐解决我的问题。我不是Xps文档的专家,但设法确定了我的问题...XPS - 使用图像打印文档
下面的示例需要DocumentPaginator
参数,只是打印文档。 第一个示例工作正常,第二个示例不打印嵌入在文档中的图像。
// this works
XpsDocumentWriter xpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(printQueue);
xpsDocumentWriter.Write(document); // where document is a DocumentPaginator
// this doesn't work (it prints but no images)
// create new doc
XpsDocument doc = new XpsDocument(package, CompressionOption.NotCompressed, "pack://TempTemporaryPackageUri.xps");
// create writer for new doc
XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(doc);
// write document
writer.Write(document, printQueue.DefaultPrintTicket);
// create writer for print job
XpsDocumentWriter xpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(printQueue);
// i think it's here where the resources are being lost
// write document
xpsDocumentWriter.Write(doc.GetFixedDocumentSequence());
我需要创建一个新文档的原因是因为我需要在分页后操作XpsDocument。
任何人都可以指出我正确的方向,关于能够将资源从一个文档复制到另一个文档?
任何意见赞赏。
由于提前,
山姆
我认为你还在追逐错误的道路。创建分页的XPS文档后,请直接修改该文档,而不是尝试复制它。 – Jon 2012-04-23 16:51:50
然后,您如何将xpsdocument打印到打印队列中。看起来,当我从getfixeddocument序列创建一个新文档时,它会丢失资源 - 或者将它们留在原始文档中。我必须缺少一些简单的 – sambomartin 2012-04-23 21:22:58
[PrintQueue.AddJob](http://msdn.microsoft.com/en-us/library/ms553644.aspx)将是一个很好的开始。 – Jon 2012-04-23 21:33:06