L_GetEmfHandleFromRtf

#include "l_bitmap.h"

L_LTFIL_API L_INT EXT_FUNCTION L_GetEmfHandleFromRtf (pRtfFileName, nPageNumber, pRtfOptions, pRasterizeDocOptions, hEmfHandle)

L_TCHAR * pRtfFileName;

/* file name */

L_INT nPageNumber;

/* page number */

pFILERTFOPTIONS pRtfOptions;

/* pointer to a structure */

pRASTERIZEDOCOPTIONS pRasterizeDocOptions;

/* pointer to a structure */

HENHMETAFILE * hEmfHandle;

/* pointer to an EMF handle */

Gets an EMF handle from a specific page in RTF file.

Parameter

Description

pRtfFileName

Character string that contains the name of the source RTF file.

nPageNumber

Number of the RTF page to get its EMF handle. The page number is 1-based. Therefore, the first page is page 1, the second page is page 2, etc.

pRtfOptions

Pointer to a structure that contains the options to be used when loading RTF file. The following options will be used: RTFFILEOPTIONS.crBackColor.

pRasterizeDocOptions

Pointer to a structure that contains the options to be used when rasterizing document files. The following options will be used: RASTERIZEDOCOPTIONS.uXResolution, RASTERIZEDOCOPTIONS.uYResolution, RASTERIZEDOCOPTIONS.dPageHeight, RASTERIZEDOCOPTIONS.dPageWidth, RASTERIZEDOCOPTIONS.dLeftMargin, RASTERIZEDOCOPTIONS.dTopMargin, RASTERIZEDOCOPTIONS.dRightMargin and RASTERIZEDOCOPTIONS.dBottomMargin

hEmfHandle

Address of an Enhanced Metafile (EMF) handle that will be updated with the obtained EMF.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The number of RTF pages depends on page settings values inside pRasterizeDocOptions.

Required DLLs and Libraries

LTFIL
File format DLLs

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64

See Also

Functions:

L_SetRTFOptions, L_GetRTFOptions

Topics:

Raster Image Functions: Loading Files

 

Loading and Saving Images

Example

//This example gets Emf handle from Rtf file

L_INT GetEmfHandleFromRtfExample(L_TCHAR* pRtfFileName, L_INT nPageNumber, HENHMETAFILE* hEmfHandle)
{
   FILERTFOPTIONS FileRtfOptios;
   RASTERIZEDOCOPTIONS RasterizeDocOptions;

   memset(&FileRtfOptios, 0, sizeof(FILERTFOPTIONS));
   FileRtfOptios.uStructSize = sizeof(FILERTFOPTIONS);
   FileRtfOptios.crBackColor = RGB(255,255,255);

   memset(&RasterizeDocOptions, 0, sizeof(RASTERIZEDOCOPTIONS));
   RasterizeDocOptions.uXResolution = 96;
   RasterizeDocOptions.uYResolution = 96;
   RasterizeDocOptions.dPageWidth = 8.5;
   RasterizeDocOptions.dPageHeight = 11.0;
   RasterizeDocOptions.dLeftMargin = 1.0;
   RasterizeDocOptions.dTopMargin = 1.0;
   RasterizeDocOptions.dRightMargin = 1.0;
   RasterizeDocOptions.dBottomMargin = 1.0;

   return L_GetEmfHandleFromRtf(pRtfFileName, nPageNumber, &FileRtfOptios, &RasterizeDocOptions, hEmfHandle);
}
#endif // #if defined(LEADTOOLS_V17_OR_LATER)