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

Free Support Forum - aspose.com

There is an error when converting EMF or WMF image to PDF

I am planning to update Aspose.Pdf to latest release version 18.6.0. But there is an error occurred when i’m trying to convert EMF or WMF image to pdf.
assets:EMFandWMF.zip (5.1 MB)

Exception caught when trying to save pdf file.
Exception Message: “Parameter is not valid.”

There is no problem in Aspose.Pdf 9.0.0.0 when converting these two images.

@Glority_Developer

Thanks for contacting support.

We have tested the scenario in our environment and observed that API was able to generate PDF from EMF image. For your reference, an output PDF document along with used code snippet is also attached.

var pdf = new Aspose.Pdf.Document();
var pdfImageSection = pdf.Pages.Add();
FileStream stream = new FileStream(dataDir + "9068096883_283cba4f47_b.emf", FileMode.Open);
var image = new Aspose.Pdf.Image { ImageStream = stream };
image.IsApplyResolution = true;
pdfImageSection.Paragraphs.Add(image);
pdfImageSection.PageInfo.Margin.Left = pdfImageSection.PageInfo.Margin.Right = pdfImageSection.PageInfo.Margin.Top = pdfImageSection.PageInfo.Margin.Bottom = 0f;
pdf.Save(dataDir + "testimage.pdf"); 

testimage.pdf (324.4 KB)

While adding your WMF file, using same code snippet, we have noticed that API generated an empty PDF document. Therefore, we have logged this issue as PDFNET-44962 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Thanks for your reply. Now we are able to generate PDF from EMF.

Btw, do you have any plan when the fix of WMF will be released?

@Glority_Developer

Thanks for your feedback.

As the issue has recently been logged in our issue tracking system, it is pending for investigation. Please note that issue has been logged under free support model and it will be resolved on first come first serve basis. There are other pending issues in the queue as well which were logged previously than this issue. As soon as we have some definite updates regarding resolution of the issue, we will let you know. Please spare us little time.

We are sorry for the inconvenience.

Hi @asad.ali
Is there any update on this issue?

@Glority_Developer

We regret to share that your issue have not been resolved due to previously logged issues in the queue. We will definitely let you know as soon as we investigate and plan to provide a fix against your issue. We greatly appreciate your patience and comprehension in this regard. Please spare us little time.

We are sorry for the inconvenience.