title: How to Extract Unicode Text from EMF file format
body: <p>I am trying to extract unicode text from the EMF files extracted from the printed SPL (spool file).</p>
  
  <p>I can't find any description or source code that describes exactly how to read the following EMF records.</p>
  
  <pre><code>EmfExtTextOutA
  EmfExtTextOutW
  EmfSmallTextOut
  </code></pre>
  
  <p>The following code is good for DrawString however EMF files I have contain only 
  EmfExtTextOutA, EmfExtTextOutW, EmfSmallTextOut records.</p>
  
  <pre><code>// Copy the unmanaged record data.
  byte[] data_array = null;
  data_array = new byte[dataSize];
  Marshal.Copy(data, data_array, 0, dataSize);
  // See how many characters are in the string.
  int num_chars = BitConverter.ToInt32(data_array, 8);
  // Get the characters.
  string txt = System.Text.Encoding.Unicode.GetString(data_array, 28, 2 * num_chars);
  Debug.Print(txt);
  </code></pre>
  
  <p>I took the code from here <a href="http://csharphelper.com/blog/2012/02/extract-text-created-by-drawstring-from-a-metafile-in-c/" rel="nofollow">http://csharphelper.com/blog/2012/02/extract-text-created-by-drawstring-from-a-metafile-in-c/</a></p>
  
  <p>Any description or code in any language is appreciated.</p>
  
  <p>I can provide the EMF files but do not know how to upload it here.</p>