public void SaveAsXps()
{
//ExStart
//ExFor:XpsSaveOptions
//ExFor:XpsSaveOptions.#ctor
//ExFor:Document.Save(String)
//ExFor:Document.Save(Stream, SaveFormat)
//ExFor:Document.Save(String, SaveOptions)
//ExId:SaveToXps_NewAPI
//ExSummary:Shows how to save a document to the Xps format using the Save method and the XpsSaveOptions class.
// Open the document
Document doc = new Document(MyDir + "Rendering.doc");
// Save document to file in the Xps format with default options
doc.Save(MyDir + @"\Artifacts\Rendering.XpsDefaultOptions.xps");
// Save document to stream in the Xps format with default options
MemoryStream docStream = new MemoryStream();
doc.Save(docStream, SaveFormat.Xps);
// Rewind the stream position back to the beginning, ready for use
docStream.Seek(0, SeekOrigin.Begin);
// Save document to file in the Xps format with specified options
// Render the first page only
XpsSaveOptions xpsOptions = new XpsSaveOptions();
xpsOptions.PageIndex = 0;
xpsOptions.PageCount = 1;
doc.Save(MyDir + @"\Artifacts\Rendering.XpsCustomOptions.xps", xpsOptions);
//ExEnd
}