You are creating a Windows Presentation Foundation application by using Microsoft .NET Framework 3.5.
You write the following code segment
(Line numbers are included for reference only).
01 object content;
02 string fileName = "theFile";
03 using (FileStream xamlFile = new FileStream(fileName + ".xaml", FileMode.Open, FileAccess.Read))
04 {
05 content = (object)XamlReader.Load(xamlFile);
06 }
07 using (Package container = Package.Open(fileName + ".xps", FileMode.Create))
08 {
09
10 }
You need to ensure that the following requirements are met:
* The application converts an existing flow document into an XPS document.
* The XPS document is generated by using the flow document format.
* The XPS document has the minimum possible size.
Which code segment should you insert at line 09?
A.
using (XpsDocument xpsDoc = new XpsDocument(container, CompressionOption.SuperFast))
{
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false) ;
rsm.SaveAsXaml(paginator);
}
B.
using (XpsDocument xpsDoc = new XpsDocument(container, CompressionOption.SuperFast))
{
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false);
rsm.Commit();
}
C.
using (XpsDocument xpsDoc = new XpsDocument(container, CompressionOption.Maximum))
{
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false);
DocumentPaginator paginator = ((IDocumentPaginatorSource)content).DocumentPaginator;
rsm.SaveAsXaml(paginator);
}
D.
using (XpsDocument xpsDoc = new XpsDocument(container, CompressionOption.SuperFast))
{
XpsSerializationManager rsm = new XpsSerializationManager(new XpsPackagingPolicy(xpsDoc), false);
DocumentPaginator paginator = ((IDocumentPaginatorSource)content).DocumentPaginator;
rsm.SaveAsXaml(paginator);
}