The FILETXTOPTIONS structure provides information on loading TXT files in LEADTOOLS.
typedef struct _FILETXTOPTIONS
{
L_UINT uStructSize;
L_BOOL bEnabled;
L_COLORREF crFontColor;
L_COLORREF crHighlight;
L_INT nFontSize;
L_TCHAR szFaceName[LF_FACESIZE];
L_BOOL bBold;
L_BOOL bItalic;
L_BOOL bUnderLine;
L_BOOL bStrikeThrough;
L_TEXT_ENCODING defaultEncoding;
L_COLORREF crBackColor;
L_TEXT_ANTI_ALIASING antiAliasing;
L_BOOL bWrap;
L_UINT uTabSize;
L_UINT uFlags;
L_DOUBLE dMinPageWidth;
L_DOUBLE dMinPageHeight;
} FILETXTOPTIONS, * pFILETXTOPTIONS;
Size of the structure. This must be set before passing this structure to the LEAD functions. Use sizeof(FILETXTOPTIONS)
to calculate this value.
Flag that indicates whether to call the filter. Possible values are:
Value | Meaning |
---|---|
TRUE | Call the filter. |
FALSE | Do not call the filter. |
The font color.
The high light color. Highlight is the color used as background for the text paragraphs found in the file. If you do not want to show the highlight color, set its value to the same as crFontColor
or crBackColor
.
The font size in points.
Character string that contains the text font face name.
Indicates whether anti-aliasing should be used when drawing text. Possible values are:
Value | Meaning |
---|---|
L_TEXT_ANTI_ALIASING_AUTO |
Let LEADTOOLS pick when to use anti-aliasing (Default). In this case, anti-aliasing is enabled when loading at >= 8 bpp and disabled for < 8 bpp. |
L_TEXT_ANTI_ALIASING_ON |
Anti-aliasing is always on. |
L_TEXT_ANTI_ALIASING_OFF |
Anti-aliasing is always off. |
Flag that indicates whether to display the text as bold. Possible values are:
Value | Meaning |
---|---|
TRUE | Displays the text as bold. |
FALSE | Displays the text as not bold. |
Flag that indicates whether to display the text as italic. Possible values are:
Value | Meaning |
---|---|
TRUE | Displays the text as italic. |
FALSE | Displays the text as not italic. |
Flag that indicates whether to display the text underlined. Possible values are:
Value | Meaning |
---|---|
TRUE | Displays the text underlined. |
FALSE | Displays the text as not underlined. |
Flag that indicates whether to display the text with a strikethrough. Possible values are:
Value | Meaning |
---|---|
TRUE | Displays the text with a strikethrough. |
FALSE | Displays the text without a strikethrough. |
Flag that indicates whether long lines of text should be wrapped into several lines or truncated. Possible values are:
Value | Meaning |
---|---|
TRUE | Split long text lines into several rows (default). |
FALSE | Truncate long lines of text. |
The text encoding for files without a byte-order mark (BOM). See L_TEXT_ENCODING for possible values.
This setting is ignored when loading files containing a BOM.
You can check whether a file has a BOM by getting the file information and examining whether FILEINFO.Flags contains the FILEINFO_HAS_BOM
flag.
The background color. Background is the color used to fill the result image before rending the text on top of it.
The length of the spaces used for the tab character. Default is 4.
This value is used to replace a tab character in a text.
If set to 0, the tab will not be replaced. The result will depend on the drawing engine used to render the text.
Various bit flags are used to influence the load. The following flags are defined:
Value | Meaning |
---|---|
L_TEXT_FLAGS_VARIABLE_WIDTH |
[0x0001] If set, the output width is calculated from the longest line in the file. In this case, FILETXTOPTIONS.bWrap and RASTERIZEDOCOPTIONS.dPageWidth are ignored. If not set, the output width is indicated by RASTERIZEDOCOPTIONS.dPageWidth . This is the default. |
L_TEXT_FLAGS_VARIABLE_HEIGHT |
[0x0002] If set, the output height is calculated so the whole text file will be loaded as one page. In this case, RASTERIZEDOCOPTIONS.dPageHeight is ignored. If not set, the page height is indicated by RASTERIZEDOCOPTIONS.dPageHeight . This is the default. |
The default value for uFlags
is 0 (no flag is set).
If >0, minimum page width, using units from RASTERIZEDOCOPTIONS.uUnit
.
If 0, there is no minimum page width.
If >0, minimum page height, using units from RASTERIZEDOCOPTIONS.uUnit
.
If 0, there is no minimum page height.
pFILETXTOPTIONS
is a pointer to a FILETXTOPTIONS structure.
Text files have no physical width or height in pixels. You can use RASTERIZEDOCOPTIONS to control how the final document is rendered as a raster image or as an SVG.
By default LEADTOOLS has set the page size to 8.5" x 11" (width x height in inches). To change the default page size use dPageWidth
and dPageHeight
properties. To change the units of measure, use RASTERIZEDOC_UNIT.
Although it is possible to enable both L_TEXT_FLAGS_VARIABLE_WIDTH
and L_TEXT_FLAGS_VARIABLE_HEIGHT
on a given page, it is not recommended. Enabling both, can result in a very large page size that reduces responsiveness and consumes more contiguous memory. Conversely, enabling either property, not both, can produce better performance for smaller page size.
The document or image width is set as follows:
L_TEXT_FLAGS_VARIABLE_WIDTH
is set in uFlags
, the output width will be dLeftMargin
+ maximum line width + dRightMargin
.L_TEXT_FLAGS_VARIABLE_WIDTH
is not set in uFlags
, the output width will be dPageWidth
. This is the default setting.The document or image height is set as follows:
L_TEXT_FLAGS_VARIABLE_HEIGHT
is set in uFlags
, text is loaded in one page and the output height will be dTopMargin
+ height of all text lines + dBottomMargin
.L_TEXT_FLAGS_VARIABLE_HEIGHT
is not set in uFlags
, the output might have multiple pages. The height of each page will be dPageHeight
. This is the default setting.L_TEXT_FLAGS_VARIABLE_WIDTH
and L_TEXT_FLAGS_VARIABLE_HEIGHT
allow the default page size to expand when the page content is larger.
If L_TEXT_FLAGS_VARIABLE_WIDTH
is set in uFlags
, the FILETXTOPTIONS.dMinPageWidth
property allows the user to specify a minimum width. And if L_TEXT_FLAGS_VARIABLE_HEIGHT
is set in uFlags
, the FILETXTOPTIONS.dMinPageHeight
property allows the user to specify a minimum height.
To illustrate the interaction of these properties and provide a recommendation, below there is a list of various cases and their results for L_TEXT_FLAGS_VARIABLE_WIDTH
and L_TEXT_FLAGS_VARIABLE_HEIGHT
properties. A sample text with 16 columns x 100 rows is used which exceeds the width and height of the default page size. The column-row arrangement must be preserved in the output. Text wrapping or trimming are undesirable in the output. The top row and last row are reproduced below (Download sample file).
Input's First Row
row1column1 row1column2 row1column3 row1column4 row1column5 row1column6 row1column7 row1column8 row1column9 row1column10 row1column11 row1column12 row1column13 row1column14 row1column15 row1column16
Input's Last Row
row100column1 row100column2 row100column3 row100column4 row100column5 row100column6 row100column7 row100colum8 row100column9 row100column10 row100column11 row100column12 row100column13 row100column14 row100column15 row100column16
Properties: L_TEXT_FLAGS_VARIABLE_WIDTH
, L_TEXT_FLAGS_VARIABLE_HEIGHT
set in uFlags
Result: The column-row format from the input is preserved. The width property is unrestricted and each column preserves the original format. Notice that these entries are in the correct row: row1column1
, row2column1
, row3column1
, etc. The page height property is restricted to default size. The result is data separated by page size that includes all input columns and rows. The output is saved over three pages using the default height.
Download sample PDF file.
Properties: L_TEXT_FLAGS_VARIABLE_WIDTH
, L_TEXT_FLAGS_VARIABLE_HEIGHT
set in uFlags
Result: The column-row format from the input is preserved. The width property is unrestricted and each column preserves the original format. Notice that these entries are in the correct row: row1column1
, row2column1
, row3column1
,...,row100column1
. The page height property is unrestricted. The result is a single image for all data. This is the case where caution must be exercised as very large data is contained on a single output page.
Download sample PDF file.
Properties: L_TEXT_FLAGS_VARIABLE_WIDTH
, L_TEXT_FLAGS_VARIABLE_HEIGHT
set in uFlags
Result: The column-row format from the input is not preserved. Both, width and height properties, are restricted to the default size and any columns beyond the default width are wrapped to the next row as is the case for row1column4
.
Download sample PDF file.
Properties: L_TEXT_FLAGS_VARIABLE_WIDTH
, L_TEXT_FLAGS_VARIABLE_HEIGHT
set in uFlags
Result: The column-row format from the input is not preserved. The width property is restricted to the default size and any columns beyond the default width are wrapped to the next row as is the case for row1column4
.
Download sample PDF file.
To illustrate the interaction of these properties, refer to the list below of four cases and their results for dMinPageWidth
and dMinPageHeight
properties. A sample text with 2 columns x 10 rows is used, which is well within the width and height values of the default page size. In general, the specific setting combination to use for these properties depends on the user's preference. However, the properties are suitable for files with page width or height dimensions that are less than the default minimum. Use these four cases as a quick preview of results under different scenarios.
The top row and last row are reproduced below (Download sample file).
Input's First Row
row1column1 row1column2
Input's Last Row
row10column1 row10column2
Properties: dMinPageWidth = 8.5, dMinPageHeight = 11
Result: The column-row format and data from the input are preserved. Setting the minimum page width to 8.5
and minimum height to 11
result in output that includes all column-row format and data within the defined page height and width.
Download sample PDF file.
Properties: dMinPageWidth = 0, dMinPageHeight = 11
Result: The column-row format and data from the input are preserved. Setting the minimum page width to 0
and minimum height to 11
result in output that includes all column-row format and data within the defined page height and width.
Download sample PDF file.
Properties: dMinPageWidth = 8.5, dMinPageHeight = 0
Result: The column-row format from the input is preserved. Setting the minimum page width to 8.5
and minimum height to 0
, the format and data are preserved within the specified dimensions.
Download sample PDF file.
Properties: dMinPageWidth = 0, dMinPageHeight = 0
Result: The column-row format from the input is preserved. The data and format are preserved within the smallest dimensions.
Download sample PDF file.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document