過去に同様の質問をしたことがありますが、それ以来、問題を解決する喜びがありませんでした。私は Xps ドキュメントの専門家ではありませんが、私の問題をこれに突き止めることができました...
次の例では、DocumentPaginator
引数を取り、ドキュメントを単純に印刷します。最初の例は機能しますが、2 番目の例はドキュメントに埋め込まれた画像を印刷しません。
// 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 を操作する必要があるためです。
あるドキュメントから別のドキュメントにリソースをコピーできることに関して、誰かが私を正しい方向に向けることができますか?
アドバイスをいただければ幸いです。
前もって感謝します、
サム