In This Topic ▼

Document Library Coordinate System

Summary

The Document class uses coordinates in 1/720 of an inch, the same unit used by the LEADTOOLS Annotations library. This value is stored in the UnitsPerInch constant and is set to 720.

The UnitsPerInch value of 720 is used to be device-independent and uniform regardless of the current screen or device resolution (DPI).

A resolution in dots per inch (DPI) is needed to convert from document coordinates to pixel and vice versa. Calculate the DPI by using the following equation:

Pixels = (Document Units / 720) * Resolution

The DocumentToPixels method uses this exact equation to convert from document units to pixels.

The following formula is used to convert from pixels to document coordinates:

Document Units = (Pixels / Resolution) * 720

The PixelsToDocument method uses this exact equation to convert from pixels to document units.

When loading documents, each page size is stored in the Size property in document units. Although rare, some documents formats such as TIFF and PDF support having different size pages and thus, the size is stored in the page object itself and not in the document.

The global document resolution is parsed by the loader and set in the DocumentPages.DefaultResolution value. Again, each page can have a different resolution depending on the document format and hence, DocumentPage.Resolution will contain the actual resolution of the page (in most cases, equal to DocumentPages.DefaultResolution).

Most of the coordinates use values of LeadPointD, LeadSizeD and LeadRectD that represent a point, a size, and a rectangle's area, respectively. The Document class contains the following helper methods to quickly convert any of these values from document to pixel coordinates and vice versa:

See Also

Document Library Features

Document Viewer Application

Loading Documents Using LEADTOOLS Document Library

Creating Documents with LEADTOOLS Document Library

Document Toolkit and Caching

Uploading Using the Document Library

Loading Encrypted Files Using the Document Library

Parsing Text with the Document Library

Barcode processing with the Document Library

Using jQuery Promises in the Document Library

Loading Images in the Document Library

Document Page Transformation

Using LEADTOOLS Document Viewer

Status Document Job Converter

Document View and Convert Redaction

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

LEADTOOLS HTML5 JavaScript