Packages

 

com.aspose.imaging.imageoptions

Class WmfOptions

  • All Implemented Interfaces:
    com.aspose.fileformats.core.imageoptions.ICompressOptions, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class WmfOptions
    extends MetafileOptions

    The wmf options.

    Code example:

    The following example shows how to convert a multipage vector image to WMF format in general way without referencing to a particular image type.


    String dir = "C:\\aspose.imaging\\net\\misc\\ImagingReleaseQATester\\Tests\\testdata\\2548";
    String inputFilePath = (dir + "Multipage.cdr");
    String outputFilePath = (dir + "Multipage.cdr.wmf");
    
    com.aspose.imaging.ImageOptionsBase exportOptions = new com.aspose.imaging.imageoptions.WmfOptions();
    
    try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath))
    {
        exportOptions.setMultiPageOptions(null);
    
        // Export only first two pages. In fact, only one page will be converted because WMF is not a multi-page format.
        com.aspose.imaging.IMultipageImage multipageImage = (image instanceof com.aspose.imaging.IMultipageImage) ? (com.aspose.imaging.IMultipageImage) image : null;
        if (multipageImage != null && (multipageImage.getPages() != null && multipageImage.getPageCount() > 2))
        {
            exportOptions.setMultiPageOptions(new com.aspose.imaging.imageoptions.MultiPageOptions(new com.aspose.imaging.IntRange(0, 2)));
        }
    
        if (image instanceof com.aspose.imaging.VectorImage)
        {
            com.aspose.imaging.imageoptions.VectorRasterizationOptions defaultOptions = (com.aspose.imaging.imageoptions.VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()});
            exportOptions.setVectorRasterizationOptions(defaultOptions);
            defaultOptions.setTextRenderingHint(com.aspose.imaging.TextRenderingHint.SingleBitPerPixel);
            defaultOptions.setSmoothingMode(com.aspose.imaging.SmoothingMode.None);
        }
    
        image.save(outputFilePath, exportOptions);
    }
    

    • Constructor Detail

      • WmfOptions

        public WmfOptions()