L_DocWriterConvert

#include "l_bitmap.h"

L_LTDOCWRT_API L_INT EXT_FUNCTION L_DocWriterConvert(pszLtdFileName, pszFileName, Format, pDocOptions, pfnStatusCallback, pUserData)

L_WCHAR * pszLtdFileName;

/* name and path to LEAD file */

L_WCHAR * pszFileName;

/* name and path to the output file to save */

DOCWRTFORMAT Format;

/* output file format */

L_VOID * pDocOptions;

/* pointer to a Document Options structure */

STATUSCALLBACK pfnStatusCallback;

/* optional callback function */

L_VOID * pUserData;

/* pointer to user data */

Converts a file from the LEAD format to any of the supported document formats.

Parameter

Description

pszLtdFileName

Character string containing the name and path to the LEAD file (source file).

pszFileName

Character string containing the name and path to the document file to save (output file).

Format

File format of the output file. Possible values are:

 

Value

Meaning

 

DOCUMENTFORMAT_PDF

[1] Portable Document format (PDF)

 

DOCUMENTFORMAT_DOC

[2] MS-Word document format (DOC)

 

DOCUMENTFORMAT_RTF

[3] Rich Text document format (RTF)

 

DOCUMENTFORMAT_HTM

[4] HyperText Markup Language document format (HTML)

 

DOCUMENTFORMAT_TXT

[5] Text file format (TXT)

 

DOCUMENTFORMAT_EMF

[6] Enhanced Meta file format (EMF)

 

DOCUMENTFORMAT_XPS

 

[7] Microsoft XML Paper Specification format (XPS)

Note: XPS format requires .NET framework 3.0

 

DOCUMENTFORMAT_DOCX

[8] MS-Word 2007/2010 document format (DocX)

Note: XPS format requires .NET framework 3.5 and Microsoft Open XML Format SDK 2.0

 

 

DOCUMENTFORMAT_XLS

MS-Excel document format (Xls)

pDocOptions

Pointer to the document object structure. It can be pointer to one of the following document options structures:

 

DOCWRTEMFOPTIONS

/*EMF format options*/

 

DOCWRTTXTOPTIONS

/*Text format options*/

 

DOCWRTPDFOPTIONS

/*PDF format options*/

 

DOCWRTDOCOPTIONS

/*DOC format options*/

 

DOCWRTRTFOPTIONS

/*RTF format options*/

 

DOCWRTHTMOPTIONS

/*HTML format options*/

 

DOCWRTXPSOPTIONS

/*XPS format options*/

 

DOCWRTDOCXOPTIONS

/*DocX(2007/2010) format options*/

 

DOCWRTXLSOPTIONS

/*Xls format options*/

pfnStatusCallback

Pointer to an optional callback function used to follow the job's progress.

 

If you do not provide a callback function, use NULL as the value of this parameter.

 

If you do provide a callback function, use the function pointer as the value of this parameter.

pUserData

Pointer that you can use to pass one or more additional parameters that the callback function needs.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function can only convert a LEAD file to the formats listed in Format. You cannot convert from a LEAD format to a LEAD format. Such conversions fail and return an error.

Required DLLs and Libraries

LtDocWrt_u.dll, LtDocWrt_x.dll
LTDocWrtEmf_u.dll, LTDocWrtEmf_x.dll
LTDocWrtTtf_u.dll, LTDocWrtTtf_x.dll
LTDocWrtPdf_u.dll, LTDocWrtPdf_x.dll
LTDocWrtDoc_u.dll, LTDocWrtDoc_x.dll
LTDocWrtRtf_u.dll, LTDocWrtRtf_x.dll
LTDocWrtHtm_u.dll, LTDocWrtHtm_x.dll
LTDocWrtTxt_u.dll, LTDocWrtTxt_x.dll
LTDocWrtXls_u.dll, LTDocWrtXls_x.dll
LTDocWrtDocx_u.dll, LTDocWrtDocx_x.dll
LTDocWrtXps_u.dll, LTDocWrtXps_x.dll
LtFil_u.dll, LtFil_x.dll
LfJb2_u.dll, LfJb2_x.dll
Lfcmp_u.dll, Lfcmp_x.dll
Lftif_u.dll, Lftif_x.dll
Lfraw_u.dll, Lfraw_x.dll
Lfbmp_u.dll, Lfbmp_x.dll
Lfpng_u.dll, Lfpng_x.dll
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_DocWriterInit

Topics:

Creating Document Formats

 

Raster Image Functions: Document Writers

Example

This example converts Lead document format (ltd) to MS Word document foramt (doc)

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName


L_LTDOCWRTTEX_API L_INT L_DocWriterConvertExample(L_VOID)
{
   L_INT nRet=0;
   DOCWRTDOCOPTIONS doc;

   doc.bFramed = TRUE;
   doc.uFlags = 0;
   doc.Options.uStructSize = sizeof(doc);

   nRet = L_DocWriterConvert(MAKE_IMAGE_PATH(TEXT("LTD_Document.ltd")),
                              MAKE_IMAGE_PATH(TEXT("DOC_Document.doc")),
                              DOCUMENTFORMAT_DOC,
                              &doc,
                              NULL,
                              NULL );
   if(nRet != SUCCESS)
      return nRet;

   return SUCCESS;
}