←Select platform

MaximumImagePixelSize Property

Summary

Maximum width or height in pixels to use when obtaining image data from the pages in this document.

Syntax

C#
VB
Java
C++
public int MaximumImagePixelSize { get; set; } 
Public Property MaximumImagePixelSize() As Integer 
   Get 
   Set 
public:  
   property int MaximumImagePixelSize 
   { 
      int get() 
      void set(int value) 
   } 
public int getMaximumImagePixelSize() 
public void setMaximumImagePixelSize(int value) 

Property Value

The maximum width or height in pixels to use when obtaining image data from the pages in this document. Default value is 0 which means to use the original size.

Remarks

The DocumentPage.GetImage, DocumentPage.GetSvg and DocumentPage.GetSvgBackImage methods are used to obtain a raster or SVG document representation of a page in the document. When the value of MaximumImagePixelSize is 0 (the default), then the image or SVG object return will have the same size as the page.

This could not be the desired behavior when the pixel size of the original document is large. For example, if the Documents library is used by a mobile application where memory size is limited. Limiting the maximum size of the images returned can also increase the performance of any type of application. The size of the data transferred between the document and the application is smaller and therefore, it can be obtained sooner and rendered faster.

To limit the maximum size of the image and SVG objects, set the value of MaximumImagePixelSize to desired pixel size. After that, any calls to GetImage, GetSvg or GetSvgBackImage will result in a raster or SVG image that is up to but not exceeding MaximumImagePixelSize in width or height. The framework performs this by resizing the data as it is being obtained while maintaining the aspect ratio.

Example: The page has a size of 8.5 by 11 inches (DocumentPage.Size is 6120 by 7920). The pixel size at a typical resolution of 300 is 2550 by 3300.

Calling GetImage set to the default of 0 will result in no re-sizing. This the image object obtained will have a size of 2550 by 3300 pixels. The scale value used is 1.0.

If the value of MaximumImagePixelSize is set to 1024, then the image will be resized before it is returned resulting in a size of 792 by 1024 pixels. This is calculated as the best of the original size into the maximum allowed while keeping the aspect ratio. The scale value used is 3.223.

However, if the value of MaximumImagePixelSize is set to 4096, then the image will be not resized since the original size fits inside the maximum value. The scale value used is 1.0.

In all cases, the scale value used will be set in DocumentPage.ImageScale. The application can use this value to determine if the image was scaled and to use in calculations involving coordinate conversions between the result image pixels and page units. The LEADTOOLS Document Viewer sets this value in the image scale of each item for a page inside the image viewer control.

The same behavior described above will occur for GetSvg (the result SVG document is resized) and GetSvgBackImage(RasterColor) at all times.

Note that setting this property to a value will update the same value in each child document.

Requirements

Target Platforms

Help Version 19.0.2017.10.18
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Documents Assembly