This documentation is archived and is not being maintained.
SerializerWriter Class
Visual Studio 2010
Defines the abstract methods and events that are required to implement a plug-in document output serializer.
System::Object
System.Windows.Documents.Serialization::SerializerWriter
System.Windows.Xps::XpsDocumentWriter
System.Windows.Documents.Serialization::SerializerWriter
System.Windows.Xps::XpsDocumentWriter
Assembly: PresentationFramework (in PresentationFramework.dll)
The SerializerWriter type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CancelAsync | When overridden in a derived class, cancels an asynchronous write operation. |
![]() | CreateVisualsCollator() | When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements. |
![]() | CreateVisualsCollator(PrintTicket, PrintTicket) | When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements together with the given print tickets. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Write(DocumentPaginator) | When overridden in a derived class, synchronously writes the content of a given DocumentPaginator to the serialization Stream. |
![]() | Write(FixedDocument) | When overridden in a derived class, synchronously writes a given FixedDocument to the serialization Stream. |
![]() | Write(FixedDocumentSequence) | When overridden in a derived class, synchronously writes a given FixedDocumentSequence to the serialization Stream. |
![]() | Write(FixedPage) | When overridden in a derived class, synchronously writes a given FixedPage to the serialization Stream. |
![]() | Write(Visual) | When overridden in a derived class, synchronously writes a given Visual element to the serialization Stream. |
![]() | Write(DocumentPaginator, PrintTicket) | When overridden in a derived class, synchronously writes paginated content together with an associated PrintTicket to the serialization Stream. |
![]() | Write(FixedDocument, PrintTicket) | When overridden in a derived class, synchronously writes a given FixedDocument together with an associated PrintTicket to the serialization Stream. |
![]() | Write(FixedDocumentSequence, PrintTicket) | When overridden in a derived class, synchronously writes a given FixedDocumentSequence together with an associated PrintTicket to the serialization Stream. |
![]() | Write(FixedPage, PrintTicket) | When overridden in a derived class, synchronously writes a given FixedPage together with an associated PrintTicket to the serialization Stream. |
![]() | Write(Visual, PrintTicket) | When overridden in a derived class, synchronously writes a given Visual element together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(DocumentPaginator) | When overridden in a derived class, asynchronously writes the content of a given DocumentPaginator to the serialization Stream. |
![]() | WriteAsync(FixedDocument) | When overridden in a derived class, asynchronously writes a given FixedDocument to the serialization Stream. |
![]() | WriteAsync(FixedDocumentSequence) | When overridden in a derived class, asynchronously writes a given FixedDocumentSequence to the serialization Stream. |
![]() | WriteAsync(FixedPage) | When overridden in a derived class, asynchronously writes a given FixedPage to the serialization Stream. |
![]() | WriteAsync(Visual) | When overridden in a derived class, asynchronously writes a given Visual element to the serialization Stream. |
![]() | WriteAsync(DocumentPaginator, Object) | When overridden in a derived class, asynchronously writes the content of a given DocumentPaginator to the serialization Stream. |
![]() | WriteAsync(DocumentPaginator, PrintTicket) | When overridden in a derived class, asynchronously writes the content of a given DocumentPaginator to the serialization Stream. |
![]() | WriteAsync(FixedDocument, Object) | When overridden in a derived class, asynchronously writes a given FixedDocument to the serialization Stream. |
![]() | WriteAsync(FixedDocument, PrintTicket) | When overridden in a derived class, asynchronously writes a given FixedDocument together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(FixedDocumentSequence, Object) | When overridden in a derived class, asynchronously writes a given FixedDocumentSequence to the serialization Stream. |
![]() | WriteAsync(FixedDocumentSequence, PrintTicket) | When overridden in a derived class, asynchronously writes a given FixedDocumentSequence together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(FixedPage, Object) | When overridden in a derived class, asynchronously writes a given FixedPage to the serialization Stream. |
![]() | WriteAsync(FixedPage, PrintTicket) | When overridden in a derived class, asynchronously writes a given FixedPage together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(Visual, Object) | When overridden in a derived class, asynchronously writes a given Visual element to the serialization Stream. |
![]() | WriteAsync(Visual, PrintTicket) | When overridden in a derived class, asynchronously writes a given Visual element together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(DocumentPaginator, PrintTicket, Object) | When overridden in a derived class, asynchronously writes paginated content together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(FixedDocument, PrintTicket, Object) | When overridden in a derived class, asynchronously writes a given FixedDocument together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(FixedDocumentSequence, PrintTicket, Object) | When overridden in a derived class, asynchronously writes a given FixedDocumentSequence together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(FixedPage, PrintTicket, Object) | When overridden in a derived class, asynchronously writes a given FixedPage together with an associated PrintTicket to the serialization Stream. |
![]() | WriteAsync(Visual, PrintTicket, Object) | When overridden in a derived class, asynchronously writes a given Visual element together with an associated PrintTicket and identifier to the serialization Stream. |
| Name | Description | |
|---|---|---|
![]() | WritingCancelled | When overridden in a derived class, occurs when a CancelAsync operation is performed. |
![]() | WritingCompleted | When overridden in a derived class, occurs when a write operation finishes. |
![]() | WritingPrintTicketRequired | When overridden in a derived class, occurs just before a PrintTicket is added to a stream by a Write or WriteAsync method. |
![]() | WritingProgressChanged | When overridden in a derived class, occurs when the SerializerWriter updates its progress. |
The following example illustrates the use of SerializerWriter.
// Create a SerializerProvider for accessing plug-in serializers. SerializerProvider serializerProvider = new SerializerProvider(); // Locate the serializer that matches the fileName extension. SerializerDescriptor selectedPlugIn = null; foreach ( SerializerDescriptor serializerDescriptor in serializerProvider.InstalledSerializers ) { if ( serializerDescriptor.IsLoadable && fileName.EndsWith(serializerDescriptor.DefaultFileExtension) ) { // The plug-in serializer and fileName extensions match. selectedPlugIn = serializerDescriptor; break; // foreach } } // If a match for a plug-in serializer was found, // use it to output and store the document. if (selectedPlugIn != null) { Stream package = File.Create(fileName); SerializerWriter serializerWriter = serializerProvider.CreateSerializerWriter(selectedPlugIn, package); IDocumentPaginatorSource idoc = flowDocument as IDocumentPaginatorSource; serializerWriter.Write(idoc.DocumentPaginator, null); package.Close(); return true; }
// ------------------------ PlugInFileFilter -------------------------- /// <summary> /// Gets a filter string for installed plug-in serializers.</summary> /// <remark> /// PlugInFileFilter is used to set the SaveFileDialog or /// OpenFileDialog "Filter" property when saving or opening files /// using plug-in serializers.</remark> private string PlugInFileFilter { get { // Create a SerializerProvider for accessing plug-in serializers. SerializerProvider serializerProvider = new SerializerProvider(); string filter = ""; // For each loadable serializer, add its display // name and extension to the filter string. foreach (SerializerDescriptor serializerDescriptor in serializerProvider.InstalledSerializers) { if (serializerDescriptor.IsLoadable) { // After the first, separate entries with a "|". if (filter.Length > 0) filter += "|"; // Add an entry with the plug-in name and extension. filter += serializerDescriptor.DisplayName + " (*" + serializerDescriptor.DefaultFileExtension + ")|*" + serializerDescriptor.DefaultFileExtension; } } // Return the filter string of installed plug-in serializers. return filter; } }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show:
