Metafile image is not rendering in PDF/XPS using .NET

Hi,
I’ve just updated from 11.3.0 to 11.4.0. I’m testing a number of reports that include metafiles. The metafiles are now missing when added to PDF, Flash and XPS Output. They show up in Word Files, ODT, and RTF.

I have not changed any software. Are there any new settings I should be aware of in these output formats?

Any thoughts appreciated.

Regards, Bruce

Hi Bruce,

Please accept my apologies for late response.

Thanks for your query. I have tried to
understand your query but unfortunately I have not completely understand
your query. It would be great, If you please elaborate your query about meta files with
more detail.

Are you facing this issue while document conversion? Please share you source document for investigation purpose as well. I appreciate your cooperation in advance for this.

Thanks for the reply. I have attached two files … one is the DOCX which has a metafile showing when the file is opened. I have also attached a PDF created by only changing the export type and the metafile is not visible.This functionality worked fine with 11.3 .0 and now is missing the meta files in the PDF, Flash, and XPS output format.

All I did was rebuild the application with 11.4.0 and have not changed anything. I could also provide the flash and xps if this would help.

Both documents use the same inputs. Did something change in the options for these output formats that might cause this?

Regards, Bruce

Hi Bruce,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.4.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-6457. Your request has also been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best Regards,

Many thanks!!! I’m also happy to test any interim solutions. Regards, Bruce

Hi Bruce,
Thanks for your request. As a temporary workaround, you can try rendering metafiles in your document as bitmaps. In this case quality will be reduced a bit, but the images will be visible at least. Please see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
PdfSaveOptions opt = new PdfSaveOptions();
opt.MetafileRenderingMode = MetafileRenderingMode.Bitmap;
doc.Save(@"C:\Temp\out.pdf", opt);

Hope this helps.
Best regards,

The issues you have found earlier (filed as WORDSNET-6457) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,

I’ve updated to the latest version and my initial testing indicated that the problem was solved. I have continued testing and have found another case that does not work.

I’ve attached a word file with a successful EMF and a PDF with incorrect output (very little text).

The EMF in the word doc works fine. You should be able to open the Doc and save as PDF to create the problem.

This type of EMF has always worked in past versions.

Regards,
Bruce

Hi Bruce,

We are really very sorry for your inconvenience.

I have managed to reproduce the same issue while using latest version of Aspose.Words for .NET 11.5.0 at my side. I have logged this issue as WORDSNET-6599 in our issue tracking system.

I have linked this forum thread to the issue WORDSNET-6599 and you will be updated via this forum thread once this issue is resolved.

As a temporary workaround, Please use the following code snippet.

Document  doc = new Document(@“C:\Temp\in.docx”);
PdfSaveOptions opt = new PdfSaveOptions();
opt.MetafileRenderingMode = MetafileRenderingMode.Bitmap;
doc.Save(@"C:\Temp\out.pdf", opt);

Hi Bruce,

In
version 11.3.0 and older Aspose.Words have used only EMF part of EMF+ dual metafiles. From 11.4.0 version Aspose.Words have started to render EMF+ part of EMF+ dual metafiles.

Unfortunately not all EMF+ features are supported so far. If Aspose.Words finds unsupported EMF + feature then it tries to fallback to rendering of EMF part of metafile. For both metafiles you provided
fallback mechanism had not worked correctly.

I have fixed the problem with the second metafile you provided. The fix will be included into the next release.

If you have any other metafiles which Aspose.Words renders incorrectly please provide them so I could investigate other possible problems.

Hi Konstantin,

Thank you very much for the description of the change. This explains why some work and some don’t. I am very surprised that the diagram did not work as it is the lowest complexity diagram.

I will continue to test all of the diagrams (most are working) and provide any others that fail.

Is there any way to provide a switch or flag to keep the old (emf only from emf dual) or set to enable the new functionality. I’ve delayed updating my product for 2 months as a result of this enhancement.

Regards, Bruce

Hi Bruce,

We will consider adding such switch. I have logged this issue as WORDSNET-6602 in our issue tracking system.

Thanks for logging the exception … I believe the work you have done is pretty close. Most of the problems I’ve seen seem to be similar. A lot is working.

I’ve attached another problem. I have determined that the size of the diagram seems to make a difference. If the diagram is not too tall, unwrapped text appears. If the diagram is very tall … no text appears. I’ve tested jumps, lines, crosses, etc and these seem to be working. I’m not sure that images are showing correctly.

See the Word Document for the way the image should look.

I’ll do one more test later this week.

Regards, Bruce

Hi Bruce,

Thanks for sharing the documents. We will update you via this forum thread once this issue is resolved.

Hi Bruce,

The problem with the third metafile you provided is the same as with second metafile. It will be fixed in the next release.

I think I have similar or the same problem.
When I convert RTF file that contains pictures, the pictures are missing in the converted PDF file. Docx conversion looks ok, although the pictures in PDF file are a little bit smaller than in the original RTF file.

I’ve tried many versions of Aspose.Words, here is the result of my testing.
I’ve even tried using the MetafileRenderingMode.Bitmap workaround for PDF files, but it hasn’t helped.

Version, Normal save, Save with PDF workaround
11.5 - normal save (no), workaround - just a small part of the pictures can be seen
11.4 - the same as in 11.5
11.3 - the same as in 11.5
11.2 - normal save - pictures are too big, workaround - not working
11.1 - the same as in 11.2

I’m sending you file, hope it will help you find the reason of the missing pictures.
Thank you

Hi Pavel,

Thanks for your query. Please use the workaround shared at following forum link.

https://forum.aspose.com/t/57332

We will update you via this forum thread once this issue is resolved.

As I’ve mentioned in my previous post, the PDF workaround does not work for me.
There is an option, when I open RTF file with Office 2007, save it (without changing the filetype) and then convert it to PDF using Aspose, then the pictures don’t disappear.

Another test was, when I tried to open the RTF file in wordpad, the images were missing. Maybe something in the RTF file is not in a standard way.

Hi

I think I got it. The problem is the RTF file and the picture properties like pich, picw, pichgoal and picwgoal. I had to set the correct values for these properties (pichgoal and picwgoal properties are not present in the RTF file, that I sent you) and now the conversion RTF to PDF works.

The PDF workaround is still needed though.

PdfSaveOptions opt = new PdfSaveOptions();
opt.MetafileRenderingMode = MetafileRenderingMode.Bitmap;
doc.Save(path, opt);

Thanks

Hi Pavel,

It is nice to hear from you that you have solved your problem. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.