I am using a EMF document for PDF conversion using the below code. But it gives me back blank converted document.
com.aspose.imaging.fileformats.emf.EmfImage image =
(com.aspose.imaging.fileformats.emf.EmfImage) com.aspose.imaging.Image.load(filePath, new com.aspose.imaging.imageloadoptions.MetafileLoadOptions(true));
try
{
com.aspose.imaging.system.io.FileStream outputStream =
new com.aspose.imaging.system.io.FileStream(outPath, com.aspose.imaging.system.io.FileMode.Create);
try
{
if(!image.getHeader().getEmfHeader().getValid())
{
//throw new com.aspose.imaging.exceptions.ImageLoadException("The file" + outPath +" is not valid");
}
com.aspose.imaging.imageoptions.EmfRasterizationOptions emfRasterization =
new com.aspose.imaging.imageoptions.EmfRasterizationOptions();
emfRasterization.setPageWidth(image.getWidth());
emfRasterization.setPageHeight(image.getHeight());
emfRasterization.setBackgroundColor(com.aspose.imaging.Color.getWhiteSmoke());
com.aspose.imaging.imageoptions.PdfOptions pdfOptions =
new com.aspose.imaging.imageoptions.PdfOptions();
pdfOptions.setVectorRasterizationOptions(emfRasterization);
image.save(outputStream.toOutputStream(), pdfOptions);
}
finally
{
outputStream.close();
outputStream.dispose();
}
}
finally
{
image.dispose();
}