maximumImagePixelSize Property


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


JavaScript Syntax
Object.defineProperty(LoadDocumentOptions.prototype, 'maximumImagePixelSize', 
	get: function(), 
	set: function(value) 
TypeScript Syntax
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.


This value will be used as the default for the created document's 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 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 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 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 GetSvgUrl (the result SVG document is resized) and GetSvgBackImageUrl. The page will typically have one ImageScale at all times.


For an example, refer to DocumentFactory.LoadFromUri.


Target Platforms

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

Leadtools.Documents Assembly