LEADTOOLS Raster Imaging C DLL Help > Quick Reference > Data Types > Loading Files > RASTERIZEDOCOPTIONS |
typedef struct _RASTERIZEDOCOPTIONS
{
L_UINT uStructSize;
L_DOUBLE dPageWidth;
L_DOUBLE dPageHeight;
L_DOUBLE dLeftMargin;
L_DOUBLE dTopMargin;
L_DOUBLE dRightMargin;
L_DOUBLE dBottomMargin;
RASTERIZEDOC_UNIT uUnit;
L_UINT uXResolution;
L_UINT uYResolution;
RASTERIZEDOC_SIZEMODE uSizeMode;
} RASTERIZEDOCOPTIONS, *pRASTERIZEDOCOPTIONS;
The RASTERIZEDOCOPTIONS structure provides information about rasterizing document files in LEADTOOLS.
Member |
Description |
|
uStructSize |
Size of the structure. This must be set before passing this structure to the LEAD functions. Use the sizeof(RASTERIZEDOCOPTIONS) macro to calculate this value. |
|
dPageWidth |
The width of the result BITMAPHANDLE measured by uUnit value. Default value is 8.5 inches. The value of dPageWidth must be greater than 0. The value of the result raster image width and height in pixels depends on the current resolution and size mode values. When the value of uSizeMode is set to RASTERIZEDOC_SIZEMODE_NONE, the original document size is kept and hence dPageWidth and dPageHeight will not be used. |
|
dPageHeight |
The height of the result BITMAPHANDLE measured by uUnit value. Default value is 11 inches. The value of dPageHeight must be greater than 0. |
|
dLeftMargin |
The margin value measured by uUnit value to use when rasterizing a document to a raster image. Default value is 1.25 inches. The value of dLeftMargin must be greater than or equal to 0. The value of the dLeftMargin, dTopMargin, dRightMargin and dBottomMargin are only used when loading RTF and TXT documents. They are not used when loading other document formats such as PDF, XPS and XLS. |
The resolution controls the pixel density of the result raster image. For example, if you specify 8.5 by 11 inches page width and height and a resolution of 96, the result image will have a pixel width and height of (8.5 * 96 = 816) and (11 * 96 = 1056) pixels. This is suitable for viewing at a 100% zoom percentage but when you start zooming in, the image will get pixelated. Pixelation may also occur if you send the raster image to a printer, since printers usually have much higher resolution than a screen.
If zooming in or high quality printing is a requirement in your code, then a higher resolution value must be specified, for example 300 by 300. For an 8.5 by 11 inch document, this results in a raster image size if (8.5 * 300 = 2550) and (11 * 300 = 3300) pixels. More than suitable for printing or zooming in. Keep in mind that increasing the resolution will increase the memory used to hold the image data. Finding the right balance between pixel density and memory consumption depends on your application needs.
After the BITMAPHANDLE is loaded, the image resolution set in bitmap.XResolution and bitmap.YResolution will be the same as uXResolution and uYResolution.
The vertical resolution is specified in uYResolution. For most normal usage, the value of
XResolution and YResolution should be equal.
dTopMargin |
The margin value measured by uUnit value to use when rasterizing a document to a raster image. Default value is 1.0 inches. The value of dTopMargin must be greater than or equal to 0. |
|
dRightMargin |
The margin value measured by uUnit value to use when rasterizing a document to a raster image. Default value is 1.25 inches. The value of dRightMargin must be greater than or equal to 0. |
|
dBottomMargin |
The margin value measured by uUnit value to use when rasterizing a document to a raster image. Default value is 1.0 inches. The value of dBottomMargin must be greater than or equal to 0. |
|
uUnit |
The unit to use for dPageWidth, dPageHeight, dLeftMargin, dTopMargin, dRightMargin and dBottomMargin. Default value is RASTERIZEDOC_UNIT_INCH. Possible value are: |
|
|
Value |
Meaning |
|
RASTERIZEDOC_UNIT_PIXEL |
[0] The values are in pixels. |
|
RASTERIZEDOC_UNIT_INCH |
[1] The values are in inches. |
|
RASTERIZEDOC_UNIT_MILLIMETER |
[2] The values are in millimeters. |
uXResolution |
The horizontal resolution to use when rasterizing document files. A value of 0 means use the current screen resolution. The default value is 150. |
|
uYResolution |
The vertical resolution to use when rasterizing document files. A value of 0 means use the current screen resolution. The default value is 150. |
uSizeMode |
The transformation to use when converting the logical size specified in dPageWidth and dPageHeight to the final physical raster image size. Default value is RASTERIZEDOC_SIZEMODE_NONE. |
|
|
You can use the uSizeMode to control how to use dPageWidth and dPageHeight to control the final raster image size. LEADTOOLS will determine the original document size (a value that can be obtained in FILEINFO.dDocPageWidth and FILEINFO.dDocPageHeight) |
|
|
and then apply the transformation from this value to determine the final bitmap width and height as follows: |
|
|
Value |
Description |
|
RASTERIZEDOC_SIZEMODE_NONE |
[0] Use the original document width and height. No transformation will be performed and dPageWidth and dPageHeight are not used. |
|
The final bitmap will have a width or height value equals to the original document size. |
|
|
RASTERIZEDOC_SIZEMODE_FIT |
[1] Fit the result raster image into dPageWidth and dPageHeight while maintaining the aspect ratio. If the original document size is smaller than the requested page size, no transformation is performed. |
|
The final bitmap will have a width or height equal to or less than the requested page width or height but not greater. |
|
|
RASTERIZEDOC_SIZEMODE_FIT_ALWAYS |
[2] Always fit the result raster image into dPageWidth and dPageHeight while maintaining the aspect ratio. If the original document size is smaller than the requested page size, then the result image is scaled up. |
|
The final bitmap will have a width or height equal to the requested page width or height. Not less and not greater. |
|
|
RASTERIZEDOC_SIZEMODE_FIT_WIDTH |
[3] Fit the result raster image width into dPageWidth while maintaining the aspect ratio. The image height will be calculated based on the transformation and dPageHeight is not used. |
|
The final bitmap will have a width equal to the requested page width. The height depends on the original document height. |
|
|
RASTERIZEDOC_SIZEMODE_STRETCH |
[4] The result raster image width and height will be exactly equal to dPageWidth and dPageHeight. Aspect ratio might be different than the original document. |
|
The final image will have a width and height equal to the requested page width and height. |
Comments
pRASTERIZEDOCOPTIONS is a pointer to a RASTERIZEDOCOPTIONS structure.
The following functions make use of this structure: