我已經問了過去的類似問題,但自那時起就沒有快樂解決我的問題。我不是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