LEADTOOLS Raster Imaging C DLL Help > Function References > L_DocWriterInit |
#include "l_bitmap.h"
L_LTDOCWRT_API L_INT EXT_FUNCTION L_DocWriterInit(phDocument, pszFileName, Format, pDocOptions, pfnStatusCallback, pUserData)
DOCUMENTWRITER_HANDLE * phDocument; |
/* pointer to the PDF document handle */ |
L_WCHAR * pszFileName; |
/* name and path to the output file */ |
DOCWRTFORMAT Format; |
/* file format for output file */ |
L_VOID* pDocOptions; |
/* pointer to a Document Options structure */ |
STATUSCALLBACK pfnStatusCallback; |
/* optional callback function */ |
L_VOID * pUserData; |
/* pointer to user data */ |
Initializes the Document Writer to create a document file.
Parameter |
Description |
|
phDocument |
Pointer to the document handle that references the document file to create. |
|
pszFileName |
Character string containing the name and path to the file to save (output file). |
|
Format |
Format of the output file. Possible values are: |
|
|
Value |
Meaning |
|
DOCUMENTFORMAT_LTD |
[0] LEAD Temporary Document (LTD) |
|
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 metafile format (EMF) |
|
DOCUMENTFORMAT_XPS |
[7] Microsoft XML Paper Specification format (XPS) |
|
DOCUMENTFORMAT_DOCX |
[8] Microsoft Word 2007/2010 document format (docx) |
|
DOCUMENTFORMAT_XLS |
[9] MS-Excel document format (Xls) |
pDocOptions |
Pointer to a Document Object structure. Possible values are: |
|
|
DOCWRTLTDOPTIONS /*LEAD format options*/ |
|
|
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 /*Microsoft XLS Excel file format (XLS)*/ |
|
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
Call L_DocWriterInit before calling any other Document Writer functions.
This function also sets the progress callback function.
Required DLLs and Libraries
LtDocWrt_u.dll, LtDocWrt_x.dll |
Platforms
Win32, x64.
See Also
Functions: |
|
Topics: |
|
|
Example
This example adds an emf page to a black html page created.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_LTDOCWRTTEX_API L_INT L_DocWriterInitExample(L_VOID) { DOCWRTPAGE Page; L_INT nRet=0; DOCWRTHTMOPTIONS html; DOCUMENTWRITER_HANDLE hDocument; memset(&html, 0, sizeof(DOCWRTHTMOPTIONS)); memset(&Page, 0, sizeof(DOCWRTPAGE)); html.Options.uStructSize = sizeof(html); html.Type = DOCWRTHTMTYPE_IECOMPATIBLE; html.FontEmbed = DOCWRTFONTEMBED_ALL; html.bUseBackgroundColor = TRUE; html.rgbBackground = RGB(0x00, 0x00, 0x00); nRet = L_DocWriterInit( &hDocument, MAKE_IMAGE_PATH(TEXT("Output.html")), DOCUMENTFORMAT_HTM, &html, NULL, NULL ); if(nRet != SUCCESS) return nRet; Page.uStructSize = sizeof(Page); Page.hEmf = GetEnhMetaFile(MAKE_IMAGE_PATH(TEXT("Ocr1.emf"))); nRet = L_DocWriterAddPage( hDocument, &Page ); if(nRet != SUCCESS) return nRet; nRet = L_DocWriterFinish( hDocument ); if(nRet != SUCCESS) return nRet; return SUCCESS; }