title: Loading RTF file with images to FlowDocument in console application
body: <p>I am creating simple console application where I need to load RTF file to FlowDocument for further work.</p>
  
  <p>I am using this code for loading file to FlowDocument:</p>
  
  <pre><code>        // Create OpenFileDialog 
          Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
  
          // Set filter for file extension and default file extension 
          dlg.DefaultExt = ".rtf";
          dlg.Filter = "RichText Files (*.rtf)|*.rtf";
  
          // Display OpenFileDialog by calling ShowDialog method 
          Nullable&lt;bool&gt; result = dlg.ShowDialog();
  
          if (result == true)
          {
              // Open document 
              string filename = dlg.FileName;
              FlowDocument flowDocument = new FlowDocument();
              TextRange textRange = new TextRange(flowDocument.ContentStart, flowDocument.ContentEnd);
  
              using (FileStream fileStream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
              {
                  textRange.Load(fileStream, DataFormats.Rtf);
              }
  
          }
  </code></pre>
  
  <p>If I do this in WPF application and show the document in flowDocumentPageViewer, everything is OK. But if I try to load file in console application, I get exception: Unrecognized structure in data format Rich Text Box, parameter name stream.</p>
  
  <p>And for some reason, this exception appears only, if there is image in document.</p>
  
  <p>Any ideas what's wrong or better how to solve it?</p>