maximumImagePixelSize Property

Summary

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

Syntax
TypeScript
JavaScript
Object.defineProperty(DocumentImages.prototype, 'maximumImagePixelSize', 
   get: function(), 
   set: function(value) 
) 
maximumImagePixelSize: number; 

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 Document Viewers demos set this value as follows:

Operating System Value
Desktop operating system 4096
Mobile operating system 2048

This value should equal the value provided to LoadDocumentOptions.maximumImagePixelSize, unless the Documents Service overwrites it. Changing this value will have no effect, except to modify the value of ImageScale. To change the maximum image size, the document must be reloaded with a different LoadDocumentOptions.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 could 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 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 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 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 ImageScale. The application can use this value to determine if the image was scaled and to use in 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.

The same behavior described above will occur for GetSvgUrl (the result SVG document is resized) and GetSvgBackImageUrl. The page will typically have one ImageScale at all times.

Requirements

Target Platforms

Help Version 22.0.2023.2.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.