Free Support Forum - aspose.com

Aspose.Imaging for .net 将emf转为PDF后的文件大小错误

A4大小的emf文件通过Aspose.Imageing 转为PDF后,文件的大小错误image.png (2.1 KB)
,是哪里出错了

代码如下:
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 = image.Width*72/600;
            emfRasterization.PageHeight = image.Height*72/600;
            //emfRasterization.BackgroundColor = Color.WhiteSmoke;

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

            image.Save(outputStream, pdfOptions);
        }

还有如要转成的PDF如何设置页边距?

@iccolor,

您能否提供源EMF文件以及生成的输出PDF文件,以便我们进一步调查。 我还假设您在使用最新的.NET 20.6 Aspose.Imaging。