We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need a sample EMFPlus file

Hi,


Currently all the EMF files which i generated through Aspose engine in EMF dual mode.

It would be very nice if someone could enlighten me , how to generate an EMFPlus file through Aspose. If you can provide me a sample EMFPlus file, which is not in Dual mode, that will be great

Or, please let me know from where I can download it from internet.

Thanks in Advance
Shambu

Hi Shambu,

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;

doc.Save("D:/output.emf", saveOptions);

Best Regards,

Hi Muhammad,

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,

Shambu

Hi Shambu,

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.

Best Regards,

Hi Muhammad,

Thanks again for the reply.
The code which you provided was useful to convert a docx file to EMF; but the generated emf was in dual mode, and not in EMFPlusonly mode.


I had tried the code present in stack overflow already and generated EMF files which was in EMFplusonly mode.But the issue with those emfplus files are, while parsing it consists only EMFPlusObject record type with object type as 'image'
ie. the whole data in EMF, even the text(EMFPlusDrawstring) and lines(EMFPlusDrawPath) are converted into an a single EMFPlusObject image object type, which is not required for me.

Inshort if I generate an emf plus file from docx or convert a dualmodeEMF to EMFPlusonly mode emf file; I want the new EMFPlusOnly file with its actual emfplus recordtypes and not as an image object.

Thanks in advance

Hi Shambu,

Thanks for the details. Please also share your Word document for further investigation.

Best Regards,

Hi Muhammad,

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.

https://msdn.microsoft.com/en-us/library/windows/desktop/ms536391(v=vs.85).aspx

Regards,

Shambu

Hi Shambu,

Can you please also share the steps you followed to parse EMF files or check if 'D' bit is true?

Best Regards,