title: How to use XPSDocument to open a XPS file that is contained in a WPF application as a binary resource?
body: <p>Basically I have embedded a xps file in a WPF application containing a XPSDocument Viewer as a resource.</p>
  
  <p>On loading the application, I just want the document viewer to display that embedded resource.</p>
  
  <pre><code>public Page1()
  {
    InitializeComponent();
    XpsDocument doc = new XpsDocument(SmartsysBrowser.Properties.Resources.test1, FileAccess.Read);
    docViewer.Document = doc.GetFixedDocumentSequence();
    docViewer.Focus();
  }
  </code></pre>
  
  <p>however this command does not pass muster</p>
  
  <pre><code>  XpsDocument doc = new XpsDocument(SmartsysBrowser.Properties.Resources.test1, FileAccess.Read);
  </code></pre>
  
  <p>I do know that I need to type the filepath of the XPS document but since it is embedded as a resource, how to?</p>
  
  <p>Thanks very much all.</p>
  
  <p>Background:
  I am supposed to make a application that will display a confidential document and since it is also important to restrict copies of it being made/printed/circulated, I have decided a ClickOnce WPF XBAP application is the way to go. My reasoning, all copies of a ClickOnce application can be rendered useless once I remove the application from the webserver. Furthermore, it seems to be the cheapest and most viable way to protect a confidential document. Please do feel free to suggest alternatives. I am always keen to learn from you all.</p>