L_DocWriterAddPage - Raster Imaging C API Help

L_DocWriterAddPage

#include "l_bitmap.h"

L_LTDOCWRT_API L_INT EXT_FUNCTION L_DocWriterAddPage(hDocument, pPage)

DOCUMENTWRITER_HANDLE hDocument; handle to an existing Document
pDOCWRTPAGE pPage; pointer to a DOCWRTPAGE page structure

Adds a page to the document handle using information from the DOCWRTPAGE structure.

Parameter

Description

hDocument

Handle to an existing Document. This handle is obtained by calling the L_DocWriterInit function.

pPage

Pointer to a DOCWRTPAGE structure that contains information about the added page.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Calls STATUSCALLBACK to follow the conversion process.

Before using the LEADTOOLS Document Writers SDK, unlock it using L_SetLicenseFile. If you want to use the PDF format you must also unlock PDF support with L_SetLicenseFile.

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, L_DocWriterFinish

Topics:

Creating Document Formats

 

Raster Image Functions: Document Writers

Example

This example creates a PDF file

L_INT L_DocWriterAddPageExample(L_VOID) 
{ 
   DOCWRTPDFOPTIONS pdf; 
   L_INT nRet=0; 
   L_DOUBLE dTextScale = 0.5; 
   DOCUMENTWRITER_HANDLE hDocument; 
   DOCWRTEMFPAGE Page; 
   BITMAPHANDLE OverlayBitmap; 
 
   pdf.bImageOverText = TRUE; 
   pdf.FontEmbed = DOCWRTFONTEMBED_ALL; 
   pdf.PdfProfile = DOCWRTPDFPROFILE_PDF; 
   pdf.bLinearized = FALSE; 
   pdf.pwszTitle = (L_WCHAR *)(LPCTSTR)TEXT("Add your title here"); 
   pdf.pwszSubject = (L_WCHAR *)(LPCTSTR)TEXT("Add your subject here"); 
   pdf.pwszKeywords = (L_WCHAR *)(LPCTSTR)TEXT("Add your keywords here"); 
   pdf.pwszAuthor = (L_WCHAR *)(LPCTSTR)TEXT("Add author name here"); 
   pdf.bProtected = TRUE; 
   pdf.pszUserPassword = "User password"; 
   pdf.pszOwnerPassword = "Owner password"; 
   pdf.EncryptionMode = (DOCWRTPDFENCRYPTIONMODE) DOCWRTPDFENCRYPTIONMODE_RC128BIT; 
   pdf.bPrintEnabled = FALSE; 
   pdf.bHighQualityPrintEnabled = TRUE; 
   pdf.bCopyEnabled = FALSE; 
   pdf.bEditEnabled = TRUE; 
   pdf.bAnnotationsEnabled = TRUE; 
   pdf.bAssemblyEnabled = FALSE; 
   pdf.uFlags = 0; 
   pdf.Options.uStructSize =  sizeof(pdf); 
   // Use default resolution 
   pdf.Options.nDocumentResolution = 0; 
   pdf.Options.PageRestriction = (DOCWRTPAGERESTRICTION) DOCWRTPAGERESTRICTION_RELAXED; 
 
   // Setup empty page size (Letter size) 
   pdf.Options.dEmptyPageWidth = 8.5; 
   pdf.Options.dEmptyPageHeight = 11; 
   pdf.Options.nEmptyPageResolution = 300; 
   pdf.Options.bMaintainAspectRatio = FALSE; 
 
   nRet = L_DocWriterInit( &hDocument,  
                           MAKE_IMAGE_PATH(TEXT("Output.pdf")),  
                           DOCUMENTFORMAT_PDF,  
                           &pdf,  
                           NULL,  
                           NULL ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("Ocr1.emf")),  
                        &OverlayBitmap, sizeof(BITMAPHANDLE),  
                        0,  
                        ORDER_BGR,  
                        NULL,  
                        NULL); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   Page.hEmf = GetEnhMetaFile(MAKE_IMAGE_PATH(TEXT("Ocr1.emf"))); 
   Page.pdwTextScale = &dTextScale; 
   Page.pOverlayBitmap = &OverlayBitmap; 
 
   nRet = L_DocWriterAddPage( hDocument, DOCWRTPAGETYPE_EMF, (L_VOID*)&Page ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_DocWriterFinish( hDocument ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   if(OverlayBitmap.Flags.Allocated) 
      L_FreeBitmap(&OverlayBitmap); 
 
   return SUCCESS; 
} 

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help