emf文件通过Aspose.Imageing for net 转为PDF文件时,发生异常:Image export failed.
代码如下:
using (var image = (EmfImage)Image.Load(filePath))
using (FileStream outputStream = new FileStream(outputfile, FileMode.Create))
{
if (!image.Header.EmfHeader.Valid)
{
throw new ImageLoadException(string.Format(“The file {0} is not valid”, outputfile));
}
EmfRasterizationOptions emfRasterization = new EmfRasterizationOptions();
emfRasterization.PageWidth =(float) (210*96/25.4);
emfRasterization.PageHeight = (float)(297*96/25.4);
//emfRasterization.BackgroundColor = Color.WhiteSmoke;
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = emfRasterization;
image.Save(outputStream, pdfOptions);
}
调试时到image.save时发生了Image export failed.的异常。原始文件为1.emfemf文件.zip (3.4 KB);异常信息见图片异常信息图.png (24.7 KB)