Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.3
|
Leadtools.Documents Namespace > DocumentImages Class : MaximumImagePixelSize Property |
public int MaximumImagePixelSize {get; set;}
'Declaration
Public Property MaximumImagePixelSize As Integer
'Usage
Dim instance As DocumentImages Dim value As Integer instance.MaximumImagePixelSize = value value = instance.MaximumImagePixelSize
public int getMaximumImagePixelSize() public void setMaximumImagePixelSize(int value)
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 with the value of MaximumImagePixelSize 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. The page will typically have one ImageScale at all times.