我使用的是aspose24.3 版本,部分emf图片转PDF乱码,请问如何解决?
代码如下
using (var image = (EmfImage)Aspose.Imaging.Image.Load(childEmfFilePath))
{
using (FileStream outputStream = new FileStream(childPdfFilePath, FileMode.Create))
{
using (PdfOptions pdfOptions = new PdfOptions())
{
using (EmfRasterizationOptions emfRasterization = new EmfRasterizationOptions())
{
float resolution = (float)96.0;
if (this.deviceMode.Orientation == Orientation.Potrait)
{
emfRasterization.PageWidth = (float)(this.deviceMode.PaperWidth * resolution / 10 / 25.4);
emfRasterization.PageHeight = (float)(this.deviceMode.PaperLength * resolution / 10 / 25.4);
}
else
{
emfRasterization.PageHeight = (float)(this.deviceMode.PaperWidth * resolution / 10 / 25.4);
emfRasterization.PageWidth = (float)(this.deviceMode.PaperLength * resolution / 10 / 25.4);
}
emfRasterization.PageHeight = (float)(image.HeightF + 8.0 * 600.0 / 25.4) * resolution / deviceMode.YResolution;
emfRasterization.PageWidth = (float)(image.WidthF + 8.0 * 600.0 / 25.4) * resolution / deviceMode.YResolution;
pdfOptions.VectorRasterizationOptions = emfRasterization;
pdfOptions.ResolutionSettings = new Aspose.Imaging.ResolutionSetting();
pdfOptions.ResolutionSettings.HorizontalResolution = resolution;
pdfOptions.ResolutionSettings.VerticalResolution = resolution;
}
image.Save(outputStream, pdfOptions);
}
}
}
emf及PDF文件.zip (127.9 KB)