The maximum width or height in pixels to use when obtaining image data from the pages in this document.
The maximum width or height in pixels to use when obtaining image data from the pages in this document. The default value is 0, which means to use the original size.
The Document Viewers demos set this value as follows:
|Desktop operating system||4096|
|Mobile operating system||2048|
This value will be used as the default for the created document's DocumentImages.maximumImagePixelSize.
The GetImageElement, GetSvgElement, and GetSvgBackImageElement 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 returned will have the same size as the page.
This may not be the desired behavior when the pixel size of the original document is large (for example, if the Document library is used by a mobile application where memory size is limited). Limiting the maximum size of the images returned can also improve 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 the desired pixel size. After that, any calls to GetImageElement, GetSvgUrl, or GetSvgBackImageElement 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 (Size is 6120 by 7920). The pixel size at a typical resolution of 300 is 2550 by 3300.
Calling GetImageElement with the value of MaximumImagePixelSize set to the default of 0 will result in no re-sizing: 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 not be 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 ImageScale. The application can use this value to determine if the image was scaled and to perform calculations involving coordinate conversions between the resulting 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.
For an example, refer to DocumentFactory.LoadFromUri.
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries