com.groupdocs.viewer.converter.options

Class ImageOptions



  • public class ImageOptions
    extends RenderOptions

    Provides options for rendering documents as image.

    • Constructor Detail

      • ImageOptions

        public ImageOptions()

        Initialize new instance of image options

    • Method Detail

      • getConvertImageFileType

        public ConvertImageFileType getConvertImageFileType()

        The type of image file, default is PNG.

      • setConvertImageFileType

        public void setConvertImageFileType(ConvertImageFileType value)

        The type of image file, default is PNG.


         The following example demonstrates how to get image representations
         of document in the specified file format.
         
         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         ImageOptions options = new ImageOptions();
         options.setConvertImageFileType(ConvertImageFileType.JPG);
         String guid = @"C:\storage\document.doc";
         java.util.List pages = imageHandler.GetPages(guid, options);
         

      • getWidth

        public int getWidth()

        The image width.

      • setWidth

        public void setWidth(int value)

        The image width.


         The following example demonstrates how to set the width
         of an image representations of the document in pixels.
         
         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = @"C:\storage\document.doc";
         ImageOptions options = new ImageOptions();
         options.setWidth(800);
         java.util.List pages = imageHandler.GetPages(guid, options);
         

      • getHeight

        public int getHeight()

        The image height.

      • setHeight

        public void setHeight(int value)

        The image height.


         The following example demonstrates how to set the height
         of an image representations of the document in pixels.
         
         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = @"C:\storage\document.doc";
         ImageOptions options = new ImageOptions();
         options.setHeight(1000);
         java.util.List pages = imageHandler.GetPages(guid, options);
         

      • getJpegQuality

        public int getJpegQuality()

        The JPEG image quality.

      • setJpegQuality

        public void setJpegQuality(int value)

        The JPEG image quality. Valid values are between 1 and 100. Default value is 90.


         The following example demonstrates how to set jpeg quality.
         
         ViewerConfig config = new ViewerConfig();
         ViewerImageHandler imageHandler = new ViewerImageHandler(config);
         String guid = @"C:\storage\document.doc";
         ImageOptions options = new ImageOptions();
         options.setConvertImageFileType(ConvertImageFileType.JPG);
         options.setJpegQuality(100);
         java.util.List pages = imageHandler.GetPages(guid, options);
         

      • getFileExtension

        public String getFileExtension()

        Gets extension for ConvertFileType.


         The following example demonstrates how to get file extension from an ImageOptions object.
         
         ImageOptions options = new ImageOptions();
         options.setConvertImageFileType(ConvertImageFileType.BMP);
         // fileExtension string will be equal to "bmp"
         String fileExtension = options.getFileExtension();