/* Send it */ private void PrintPages(XpsDocumentWriter xpsdw, FixedDocumentSequence fixdoc) { m_docWriter = xpsdw; xpsdw.WritingCompleted += new WritingCompletedEventHandler(AsyncCompleted); xpsdw.WritingProgressChanged += new WritingProgressChangedEventHandler(AsyncProgress); xpsdw.WriteAsync(fixdoc); }
public void PrintDocumentAsync(FixedDocument fixedDocument) { //Get a hold of a PrintQueue. PrintQueue printQueue = GetPrintQueue(); //Create a document writer to print to. xpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(printQueue); //We want to know when the printing progress has changed so //we can update the UI. xpsDocumentWriter.WritingProgressChanged += PrintAsync_WritingProgressChanged; //We also want to know when the print job has finished, allowing //us to check for any problems. xpsDocumentWriter.WritingCompleted += PrintAsync_Completed; StartLongPrintingOperation(fixedDocument.Pages.Count); //Print the FixedDocument asynchronously. xpsDocumentWriter.WriteAsync(fixedDocument); }
// ------------------------- PrintVisualAsync ------------------------- /// <summary> /// Initiates asynchronous output of a given /// visual to a specified document writer.</summary> /// <param name="xpsdw"> /// The document writer to output to.</param> /// <param name="v"> /// The visual to print.</param> private void PrintVisualAsync(XpsDocumentWriter xpsdw, Visual v) { _xpsdwActive = xpsdw; // Save the active document writer. xpsdw.WritingCompleted += new WritingCompletedEventHandler(AsyncPrintCompleted); xpsdw.WriteAsync(v); // Write the visual to a single page. }
// --------------- PrintSingleFlowContentDocumentAsync ---------------- /// <summary> /// Initiates asynchronous output of a given paginated /// flow document to a specified document writer.</summary> /// <param name="xpsdw"> /// The document writer to output to.</param> /// <param name="idp"> /// The paginated flow document to print.</param> private void PrintSingleFlowContentDocumentAsync( XpsDocumentWriter xpsdw, DocumentPaginator idp) { _xpsdwActive = xpsdw; // Save the active document writer. xpsdw.WritingCompleted += new WritingCompletedEventHandler(AsyncPrintCompleted); xpsdw.WriteAsync(idp); // Write the IDP as a document. }
// --------------- PrintSingleFixedContentDocumentAsync --------------- /// <summary> /// Initiates asynchronous print of a given fixed /// document to a specified document writer.</summary> /// <param name="xpsdw"> /// The document writer to output to.</param> /// <param name="fd"> /// The fixed document to print.</param> private void PrintSingleFixedContentDocumentAsync( XpsDocumentWriter xpsdw, FixedDocument fd) { _xpsdwActive = xpsdw; // Save the active document writer. xpsdw.WritingCompleted += new WritingCompletedEventHandler(AsyncPrintCompleted); xpsdw.WriteAsync(fd); // Print the FixedDocument. }
// -------------- PrintMultipleFixedContentDocumentsAsync ------------- /// <summary> /// Initiates asynchronous print of multiple fixed documents from a /// given FixedDocumentSequence to a specified DocumentWriter.</summary> /// <param name="xpsdw"> /// The document writer to output to.</param> /// <param name="fds"> /// The fixed document sequence to print.</param> private void PrintMultipleFixedContentDocumentsAsync( XpsDocumentWriter xpsdw, FixedDocumentSequence fds) { _xpsdwActive = xpsdw; // Save the active document writer. xpsdw.WritingCompleted += new WritingCompletedEventHandler(AsyncPrintCompleted); xpsdw.WritingProgressChanged += new WritingProgressChangedEventHandler(AsyncPrintingProgress); // Write the FixedDocumentSequence as a // collection of documents asynchronously. xpsdw.WriteAsync(fds); }