Convert EMF file to Text file and keep original format layout

Text Output - Extract ASCII and UNICODE text from EMF and WMF files.
How to extract text from .emf spool file?
How to Extract Unicode Text from EMF file format?
Extract and Edit Text From EMF Spool file?

Hi, I have an .emf spool file and I want to extract the data (text, images etc).
But how?

I know I have to use EMR_EXTTEXTOUTW or EMR_EXTTEXTOUTA, but I don't know how to use it..

Any help?
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.


I created a program that reads an emf file and gets the text with this code:

int CALLBACK EnhMetaFileProc (HDC hdc, HANDLETABLE * pHandleTable,
CONST ENHMETARECORD * pEmfRecord, int iHandles, LPARAM pData)
        ENHMETARECORD * pEmfr;
        pEmfr = (ENHMETARECORD *) malloc (pEmfRecord->nSize);
        CopyMemory (pEmfr, pEmfRecord, pEmfRecord->nSize);
                PEMREXTTEXTOUTW pExtTextOutW = (PEMREXTTEXTOUTW)pEmfr;
                MessageBox(NULL,(LPWSTR)((BYTE *)pEmfr +
        PlayEnhMetaFileRecord (hdc, pHandleTable, pEmfr, iHandles) ;
        free (pEmfr) ;
        return TRUE ;

The text is : (LPWSTR)((BYTE *)pEmfr + pExtTextOutW->emrtext.offString)
The problem is that if(pExtTextOutW->emrtext.fOptions==ETO_GLYPH_INDEX)
I get some stranges characters , not the text.
Can someone help me to get the right characters?

Thank You.
Hi, I'm new to this kind of programming.

I want to make an app, that takes an emf spool file,extract text and photos, and edit the file before it is print.

I don't know how to use EMR_EXTTEXTOUTA,EMR_EXTTEXTOUTW and EMR_SMALLTEXTOUT and how to edit the text.

VeryPDF has a EMF to Text Converter Command Line and SDK products which can be used to extract Unicode text from EMF and WMF files. This program can also keep the original page layout and format, it can align text columns in generated text file perfectly.

This is original EMF file, it contains some tables and columns,


We are run following command line to convert this EMF file to Text file,

emf2txt.exe D:\test.emf D:\out.txt

You will get following text contents,


If you need more information about this EMF to Text Converter Command Line or SDK product, please feel free to contact us, we will assist you asap,

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Verify Code   If you cannot see the CheckCode image,please refresh the page again!