L_PdfCompInit

#include "l_bitmap.h"
#include "lpdfComp.h"

L_LCMRC_API L_INT L_PdfCompInit (phDocument, pCallback, UserData)

LCPDF_HANDLE * phDocument;

/* pointer to the PDF document handle */

pPDFCOMP_IMAGECALLBACK pCallback;

/* optional callback function */

HANDLE UserData;

/* user data handle*/

Initializes the PDF compressor and creates an empty PDF document file in the memory.

Parameter

Description

phDocument

Pointer to the PDF document handle referencing the PDF document file to create.

pCallback

Optional callback function; for processing each segment. Use the function pointer as the value of this parameter.

 

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.

 

L_PdfCompInsertMRC calls this callback function to allow the user to add or cancel adding any segment to the document. The callback function must adhere to the function prototype described in pPDFCOMP_IMAGECALLBACK function.

UserData

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

 

To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to Handle. The callback function, which receives the address in its own UserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

 

If the additional parameters are not needed, you can pass NULL in this parameter.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

L_PdfCompInit must be called before calling any other PDF compressor functions.

This function also sets the callback function to be used anytime an MRC segmented bitmap is inserted or written using the L_PdfCompXXX functions.

When the handle to the PDF document is no longer needed, it should be freed by calling L_PdfCompFree. For every call to L_PdfCompInit there must be a call to L_PdfCompFree.

Required DLLs and Libraries

LCMRC
LCPDF
LCENC
LCZIB
LTSGM

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

See Also

Functions:

L_PdfCompFree, pPDFCOMP_IMAGECALLBACK

Topics:

Creating a Compressed PDF File

 

PDF Compressor Functions: Creating a File

Example

For an example, refer to L_PdfCompInsertNormal.