Udostępnij przez


XpsDocumentWriter.Write Metoda

Definicja

Przeciążenia

Write(Visual, PrintTicket)

Zapisuje synchronicznie określony Visual element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

Write(FixedPage, PrintTicket)

Zapisuje synchronicznie określony FixedPage element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

Write(FixedDocumentSequence, PrintTicket)

Zapisuje synchronicznie określony FixedDocumentSequence element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

Write(FixedDocument, PrintTicket)

Zapisuje synchronicznie obiekt FixedDocument wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

Write(String, XpsDocumentNotificationLevel)

Zapisuje synchronicznie określony dokument XPS w obiekcie docelowym XpsDocument lub PrintQueue.

Write(DocumentPaginator, PrintTicket)

Zapisuje synchronicznie z podziałem na strony zawartość z określonego DocumentPaginator obiektu wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

Write(FixedPage)

Zapisuje synchronicznie określony FixedPage obiekt docelowy XpsDocument lub PrintQueue.

Write(FixedDocumentSequence)

Zapisuje synchronicznie określony FixedDocumentSequence obiekt docelowy XpsDocument lub PrintQueue.

Write(FixedDocument)

Zapisuje synchronicznie określony FixedDocument obiekt docelowy XpsDocument lub PrintQueue.

Write(DocumentPaginator)

Zapisuje synchronicznie z podziałem na strony zawartość z określonego DocumentPaginator obiektu docelowego XpsDocument lub PrintQueue.

Write(String)

Synchronicznie zapisuje określony dokument XPS w obiekcie docelowym XpsDocument lub PrintQueue.

Write(Visual)

Zapisuje synchronicznie określony Visual obiekt docelowy XpsDocument lub PrintQueue.

Write(Visual, PrintTicket)

Zapisuje synchronicznie określony Visual element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Media.Visual * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (visual As Visual, printTicket As PrintTicket)

Parametry

visual
Visual

To Visual jest napisane.

printTicket
PrintTicket

Obiekt PrintTicket reprezentujący domyślne preferencje drukowania dokumentu.

Uwagi

Aby zapisać wsadowe polecenie Visual, użyj polecenia VisualsToXpsDocument.

Ta metoda nie weryfikuje ani nie modyfikuje określonego printTicket elementu dla określonego PrintQueueelementu . W razie potrzeby użyj MergeAndValidatePrintTicket metody , aby utworzyć obiekt PrintTicket specyficzny dla PrintQueue elementu i jest prawidłowy dla określonej drukarki.

Dotyczy

Write(FixedPage, PrintTicket)

Zapisuje synchronicznie określony FixedPage element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedPage ^ fixedPage, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedPage fixedPage, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedPage * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedPage As FixedPage, printTicket As PrintTicket)

Parametry

fixedPage
FixedPage

Strona, która jest napisana.

printTicket
PrintTicket

Obiekt PrintTicket reprezentujący domyślne preferencje drukowania dla strony.

Uwagi

Ta metoda nie weryfikuje ani nie modyfikuje określonego printTicket elementu dla określonego PrintQueueelementu . W razie potrzeby użyj MergeAndValidatePrintTicket metody , aby utworzyć obiekt PrintTicket specyficzny dla PrintQueue elementu i jest prawidłowy dla określonej drukarki.

Dotyczy

Write(FixedDocumentSequence, PrintTicket)

Zapisuje synchronicznie określony FixedDocumentSequence element wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedDocumentSequence * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedDocumentSequence As FixedDocumentSequence, printTicket As PrintTicket)

Parametry

fixedDocumentSequence
FixedDocumentSequence

Zestaw zapisanych dokumentów.

printTicket
PrintTicket

Obiekt PrintTicket reprezentujący domyślne preferencje drukowania dla zestawu dokumentów.

Uwagi

XpsDocument Chociaż klasa ma pojedynczą nazwę, XpsDocument może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje FixedDocument zestaw FixedDocument elementów lub do istniejącego zestawu.

Ta metoda nie weryfikuje ani nie modyfikuje określonego printTicket elementu dla określonego PrintQueueelementu . W razie potrzeby użyj MergeAndValidatePrintTicket metody , aby utworzyć obiekt PrintTicket specyficzny dla PrintQueue elementu i jest prawidłowy dla określonej drukarki.

Dotyczy

Write(FixedDocument, PrintTicket)

Zapisuje synchronicznie obiekt FixedDocument wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocument ^ fixedDocument, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.FixedDocument fixedDocument, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.FixedDocument * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (fixedDocument As FixedDocument, printTicket As PrintTicket)

Parametry

fixedDocument
FixedDocument

Napisany dokument.

printTicket
PrintTicket

Obiekt PrintTicket reprezentujący domyślne preferencje drukowania dokumentu.

Uwagi

XpsDocument Chociaż klasa ma pojedynczą nazwę, XpsDocument może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje element FixedDocument do zestawu.

Ta metoda nie weryfikuje ani nie modyfikuje określonego printTicket elementu dla określonego PrintQueueelementu . W razie potrzeby użyj MergeAndValidatePrintTicket metody , aby utworzyć obiekt PrintTicket specyficzny dla PrintQueue elementu i jest prawidłowy dla określonej drukarki.

Dotyczy

Write(String, XpsDocumentNotificationLevel)

Zapisuje synchronicznie określony dokument XPS w obiekcie docelowym XpsDocument lub PrintQueue.

public:
 void Write(System::String ^ documentPath, System::Windows::Xps::XpsDocumentNotificationLevel notificationLevel);
public void Write (string documentPath, System.Windows.Xps.XpsDocumentNotificationLevel notificationLevel);
override this.Write : string * System.Windows.Xps.XpsDocumentNotificationLevel -> unit
Public Sub Write (documentPath As String, notificationLevel As XpsDocumentNotificationLevel)

Parametry

documentPath
String

Ścieżka dokumentu źródłowego.

notificationLevel
XpsDocumentNotificationLevel

Wskazanie, czy powiadomienie jest włączone.

Uwagi

Po notificationLevel wyłączeniu program XpsDocumentWriter kopiuje serializowany dokumentXPS do obiektu docelowego XpsDocument lub PrintQueue utworzony przez program XpsDocumentWriter. Gdy notificationLevel jest włączona, XpsDocumentWriter pierwszy deserializuje dokument, następnie reerializuje go, a następnie zapisuje go w miejscu docelowym z powiadomieniami o postępie, ponieważ każda strona jest danymi wyjściowymi.

XpsDocument Chociaż klasa ma pojedynczą nazwę, XpsDocument może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje FixedDocument elementy w źródle do sekwencji FixedDocument elementów w obiekcie docelowym XpsDocument lub PrintQueue.

Jeśli notificationLevel parametr jest określony jako ReceiveNotificationEnabled, powiadomienia są generowane tylko wtedy, gdy dokument jest serializowany, a nie drukowany. Aby otrzymywać powiadomienia, dokument musi zostać ponownie zainicjowany. Gdy dokument jest ponownie sformatowany, usuwana jest cała zawartość z dokumentu Package , która nie jest wymagana do zachowania przez specyfikację papieru XML (XPS ). Ponowna synchronizacja spowoduje również usunięcie wszystkich rozszerzeń ze FixedPage znaczników, w tym całej rozszerzonej zawartości XPS.

Jeśli notificationLevel zostanie określony jako ReceiveNotificationDisabled dokument, nie zostanie ponownie zainicjowany i żadna rozszerzona zawartość zostanie zachowana, nawet po wydrukowaniu.

Zgodnie z projektem ta Write metoda nie wywołuje WritingPrintTicketRequired zdarzenia.

Dotyczy

Write(DocumentPaginator, PrintTicket)

Zapisuje synchronicznie z podziałem na strony zawartość z określonego DocumentPaginator obiektu wraz z obiektem PrintTicket docelowym XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Documents.DocumentPaginator documentPaginator, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Documents.DocumentPaginator * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (documentPaginator As DocumentPaginator, printTicket As PrintTicket)

Parametry

documentPaginator
DocumentPaginator

Obiekt, który zawiera wskaźnik do niepaginowanego materiału źródłowego, a także zawiera metody stronicowania materiału.

printTicket
PrintTicket

Obiekt PrintTicket reprezentujący domyślne preferencje drukowania dla materiału.

Uwagi

Ta metoda nie weryfikuje ani nie modyfikuje określonego printTicket elementu dla określonego PrintQueueelementu . W razie potrzeby użyj MergeAndValidatePrintTicket metody , aby utworzyć obiekt PrintTicket specyficzny dla PrintQueue elementu i jest prawidłowy dla określonej drukarki.

Dotyczy

Write(FixedPage)

Zapisuje synchronicznie określony FixedPage obiekt docelowy XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedPage ^ fixedPage);
public override void Write (System.Windows.Documents.FixedPage fixedPage);
override this.Write : System.Windows.Documents.FixedPage -> unit
Public Overrides Sub Write (fixedPage As FixedPage)

Parametry

fixedPage
FixedPage

Strona zapisana w obiekcie XpsDocument.

Dotyczy

Write(FixedDocumentSequence)

Zapisuje synchronicznie określony FixedDocumentSequence obiekt docelowy XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocumentSequence ^ fixedDocumentSequence);
public override void Write (System.Windows.Documents.FixedDocumentSequence fixedDocumentSequence);
override this.Write : System.Windows.Documents.FixedDocumentSequence -> unit
Public Overrides Sub Write (fixedDocumentSequence As FixedDocumentSequence)

Parametry

fixedDocumentSequence
FixedDocumentSequence

Zestaw dokumentów zapisywanych w obiekcie XpsDocument.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą Write metody napisać sekwencję dokumentów XPS.

private void SaveMultipleFixedContentDocuments(
             XpsDocumentWriter xpsdw, FixedDocumentSequence fds)
{
    // Write the FixedDocumentSequence as a collection of documents
    xpsdw.Write(fds);
}
Private Sub SaveMultipleFixedContentDocuments(ByVal xpsdw As XpsDocumentWriter, ByVal fds As FixedDocumentSequence)
    ' Write the FixedDocumentSequence as a collection of documents
    xpsdw.Write(fds)
End Sub

Uwagi

XpsDocument Chociaż klasa ma pojedynczą nazwę, XpsDocument może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje FixedDocument zestaw FixedDocument elementów lub do istniejącego zestawu.

Dotyczy

Write(FixedDocument)

Zapisuje synchronicznie określony FixedDocument obiekt docelowy XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::FixedDocument ^ fixedDocument);
public override void Write (System.Windows.Documents.FixedDocument fixedDocument);
override this.Write : System.Windows.Documents.FixedDocument -> unit
Public Overrides Sub Write (fixedDocument As FixedDocument)

Parametry

fixedDocument
FixedDocument

Dokument, który jest zapisywany w obiekcie XpsDocument.

Przykłady

W poniższym przykładzie pokazano, jak użyć tej metody do zapisu w dokumencie XPS.

private void SaveSingleFixedContentDocument(
             XpsDocumentWriter xpsdw, FixedDocument fd)
{
    xpsdw.Write(fd);        // Write the FixedDocument as a document.
}
Private Sub SaveSingleFixedContentDocument(ByVal xpsdw As XpsDocumentWriter, ByVal fd As FixedDocument)
    xpsdw.Write(fd) ' Write the FixedDocument as a document.
End Sub

Uwagi

XpsDocument Chociaż klasa ma pojedynczą nazwę, XpsDocument może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje element FixedDocument do zestawu.

Dotyczy

Write(DocumentPaginator)

Zapisuje synchronicznie z podziałem na strony zawartość z określonego DocumentPaginator obiektu docelowego XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Documents::DocumentPaginator ^ documentPaginator);
public override void Write (System.Windows.Documents.DocumentPaginator documentPaginator);
override this.Write : System.Windows.Documents.DocumentPaginator -> unit
Public Overrides Sub Write (documentPaginator As DocumentPaginator)

Parametry

documentPaginator
DocumentPaginator

Obiekt, który zawiera wskaźnik do niepaginowanego materiału źródłowego, a także zawiera metody stronicowania materiału.

Przykłady

W poniższym przykładzie pokazano, jak używać Write metody do zapisywania w dokumencie XPS.

private void SaveSingleFlowContentDocument(
             XpsDocumentWriter xpsdw, DocumentPaginator docPaginator)
{
    xpsdw.Write(docPaginator); // Write the DocPaginator as a document.
}
Private Sub SaveSingleFlowContentDocument(ByVal xpsdw As XpsDocumentWriter, ByVal docPaginator As DocumentPaginator)
    xpsdw.Write(docPaginator) ' Write the DocPaginator as a document.
End Sub

Dotyczy

Write(String)

Synchronicznie zapisuje określony dokument XPS w obiekcie docelowym XpsDocument lub PrintQueue.

public:
 void Write(System::String ^ documentPath);
public void Write (string documentPath);
override this.Write : string -> unit
Public Sub Write (documentPath As String)

Parametry

documentPath
String

Ścieżka dokumentu źródłowego.

Uwagi

XpsDocumentWriter Chociaż klasa ma pojedynczą nazwę, XpsDocumentWriter może być jednym FixedDocument lub zestawem wielu dokumentów. Ta metoda dodaje FixedDocument elementy w źródle do zestawu FixedDocument elementów w obiekcie docelowym XpsDocumentWriter lub PrintQueue.

Ta Write metoda reserializuje określony dokument XPS, który usuwa całą zawartość z elementu Package , który nie jest wymagany do zachowania przez specyfikację papieru XML. Ponowna synchronizacja usuwa również wszystkie rozszerzenia z FixedPage adiustacji, w tym każdą rozszerzoną zawartość XPS.

Zgodnie z projektem ta Write metoda nie zgłasza WritingPrintTicketRequired zdarzenia.

Dotyczy

Write(Visual)

Zapisuje synchronicznie określony Visual obiekt docelowy XpsDocument lub PrintQueue.

public:
 override void Write(System::Windows::Media::Visual ^ visual);
public override void Write (System.Windows.Media.Visual visual);
override this.Write : System.Windows.Media.Visual -> unit
Public Overrides Sub Write (visual As Visual)

Parametry

visual
Visual

To Visual jest napisane.

Przykłady

W poniższym przykładzie pokazano, jak użyć Write metody do zapisania Visual elementu w dokumencie XPS.

private void SaveVisual(XpsDocumentWriter xpsdw, Visual v)
{
    xpsdw.Write(v); // Write visual to single page
}
Private Sub SaveVisual(ByVal xpsdw As XpsDocumentWriter, ByVal v As Visual)
    xpsdw.Write(v) ' Write visual to single page
End Sub

Uwagi

Aby zapisać wsadowe polecenie Visual, użyj polecenia VisualsToXpsDocument.

Dotyczy