We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

EMF to PDF conversion gives blank document using Aspose.Imaging for Java

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();
    }

1003.emf.zip (17.7 KB)

attaching sample document

@adwantgoutam,

I have worked with files shared by you and have been able to observe the issue. An issue with ID IMAGINGJAVA-863 has been logged into our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

Hi Adnan,

Thanks for your reply. Can you kindly follow up and update ? - This is little urgent for us.

@adwantgoutam,

We will surely keep you updated regarding this issue.

Hi Adnan,

This is little important for us and we cant proceed with buying the full version if this doesn’t work. Can you kindly update us on priority? Thanks.

@adwantgoutam,

I have observed your comments. I like to inform this issue is going to resolved tentatively in Aspose.Imaging for Java 18.1. We will share good news with you soon.

Hi Team, any idea on the fix or the release date? - is it possible to provide us the beta version so we test it from our side?

@adwantgoutam,

I have observed your comments. I like to share that this issue is going to be resolved tentatively in Aspose.Imaging 18.1 and this version of Aspose.Imaging will be released soon. We will share good news with you soon.

The issues you have found earlier (filed as IMAGINGJAVA-863) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz