3

I am trying to extract unicode text from the EMF files extracted from the printed SPL (spool file).

I can't find any description or source code that describes exactly how to read the following EMF records.

EmfExtTextOutA
EmfExtTextOutW
EmfSmallTextOut

The following code is good for DrawString however EMF files I have contain only EmfExtTextOutA, EmfExtTextOutW, EmfSmallTextOut records.

// 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);

I took the code from here http://csharphelper.com/blog/2012/02/extract-text-created-by-drawstring-from-a-metafile-in-c/

Any description or code in any language is appreciated.

I can provide the EMF files but do not know how to upload it here.

Patrik
  • 1,286
  • 1
  • 31
  • 64

0 Answers0