facebooktwittermenuarrow-up

GemBox Support Forum

Poor image quality of vector images (WMF and EMF formats)

Hi there

I have a word template that I have added a vector image to. When I convert the Word doc to PDF using GemBox document 3.1, the quality of that image is really poor and blocky. Is there a setting to not downsample such images and add them to the PDF document as a vector?

I also have the same issue where I need to dynamically add star ratings to certain parts of my document. I have 5 WMF files, each representing a different 5 star rating. I then create a picture object in code from the correct WMF and set a ContentRange’s content to it. Again, here, each star rating looks really poor in comparison to the original image.

Am I missing a step?

Thank you!

Matt

Hi Matt,

Unfortunately, GemBox.Document doesn’t directly support rendering vector image formats (WMF and EMF).

Instead, GemBox.Document will convert them to PNG when printing and when saving to PDF.
You can control the quality of this conversion by using the PdfSaveOptions.MetafileScaleFactor (please read the property’s remarks).

For example, try something like the following:

var document = DocumentModel.Load("input.docx");

var options = new PdfSaveOptions();
options.MetafileScaleFactor = 5;

document.Save("output.pdf", options);

Or as a workaround, can you replace those WMF images with SVG images?

Last, we have an internal support ticket for adding direct support for WMF and EMF vector image formats when exporting them to PDF instead of converting them to PNG.
I have now added your report to it as well to increase its priority, but unfortunately at this moment, I cannot tell you when it will be implemented.

Regards,
Mario