You can use the following code for this purpose.
var doc = new Aspose.Words.Document("D:/sample.docx");
var saveOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Emf);
saveOptions.PageIndex = 1;
saveOptions.PageCount = 1;
saveOptions.MetafileRenderingOptions.EmfPlusDualRenderingMode = Aspose.Words.Saving.EmfPlusDualRenderingMode.EmfPlusWithFallback;
Thanks a lot for the help provided and but i'm not able to generate an EMFPlus only file with this code;
and still the EMF file generated is in EMFPlusDualMode. ie 'D' flag bit is set for the metafile generated.
I need to convert an existing emf file in "dual-mode" to "emfplus only" mode.
Details about 'D' flag in EmfPlusHeader Recordtype from Microsoft EMFPlus document:
D (1 bit): If set, this flag indicates that this metafile is "dual-mode", which means that it contains two sets of records, each of which completely specifies the graphics content.
If clear, the graphics content is specified by EMF+ records, and possibly EMF records that are preceded by an EmfPlusGetDC record.
If this flag is set, EMF records alone SHOULD suffice to define the graphics content.
Note that whether the "dual-mode" flag is set or not, some EMF records are always present, namely EMF control records and the EMF records that contain EMF+ records.
Thanks in advance,
The code in my previous post can be used to convert a Word document only. If you are having any issue in converting Word document to EMFPlus only, please share your input document for further investigation.
As far as converting an existing EMF file in dual-mode to EMFPluse only, please use the code suggested in this post http://stackoverflow.com/questions/32368237/need-an-emfplus-sample-file.
Thanks for the details. Please also share your Word document for further investigation.
Thanks for the reply. Please find the attached sample.docx file which I converted to EMF using the code which you provided. I’m also attaching the 3 EMF files which I generated using that three different options. If you parse those EMF files you would find that, for all the three files the ‘D’ bit is true, which means its in EMF+ dual mode. As per Microsoft documentation there are two variations of EMF+ format : EMF+Only and EMF+Dual. I need to generate an EMF+Only from doc file or to convert an existing EMF+Dual to EMF+Only format.
Please find below the link which I reffered.
Can you please also share the steps you followed to parse EMF files or check if 'D' bit is true?