Free Support Forum - aspose.com

Aspose.Imaging for Net EMF文件转PDF,内容错误

emf文件通过Aspose.Imageing for net 转为PDF文件时,PDF内容错误:代码如下
string outPath = filePath + “.pdf”;

            using (var image = (EmfImage)Image.Load(filePath))
            using (FileStream outputStream = new FileStream(outPath, FileMode.Create))
            {
                if (!image.Header.EmfHeader.Valid)
                {
                    throw new ImageLoadException(string.Format("The file {0} is not valid", outPath));
                }

                EmfRasterizationOptions emfRasterization = new EmfRasterizationOptions();
                emfRasterization.PageWidth = image.Width;
                emfRasterization.PageHeight = image.Height;
                emfRasterization.BackgroundColor = Color.WhiteSmoke;

                PdfOptions pdfOptions = new PdfOptions();
                pdfOptions.VectorRasterizationOptions = emfRasterization;

                image.Save(outputStream, pdfOptions);
            }

emf文件:1.emf,转PDF结果文件:1.pdf附加文件.zip (38.8 KB)

@iccolor

您能否以快照的形式突出显示该问题,以显示EMF和PDF之间的差异,以便我们进一步调查。

附件文件中有这两个文件的,我把这两个截图也发一下图片2.png (271.7 KB)

还有字体明显不一样了,如何能做到原样转换?

@iccolor

似乎与执行rendeirng的计算机上缺少字体有关。 您能否确保在执行渲染的计算机上可以使用EMF中使用的字体。