ImageGear for C and C++ on Linux v18.8 - Updated
IG_PDF_initialize
API Reference Guide > PDF Component API Reference > PDF Component Functions Reference > IG_PDF_initialize

This function is used to initialize the ImageGear PDF Component.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_PDF_initialize(
        LPVOID lpVoid
);

Arguments:

Name Type Description
lpVoid LPVOID Reserved, must be set to NULL.

Return Value:

Error count

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
AT_ERRCOUNT ErrCount = 0;
static char* pdf_path = "<Home directory>/Accusoft/ImageGear19/bin/Resource/PDF";
static char* ps_path = "<Home directory>/Accusoft/ImageGear19/bin/Resource/PS";
IG_gctrl_item_set("PDF.PDF_RESOURCE_PATH", AM_TID_MAKELP(AM_TID_CHAR), (LPVOID)pdf_path, strlen(pdf_path) + 1, NULL);
IG_gctrl_item_set("PDF.PS_RESOURCE_PATH", AM_TID_MAKELP(AM_TID_CHAR), (LPVOID)ps_path, strlen(ps_path) + 1, NULL);
ErrCount += IG_PDF_initialize(NULL);
//...
ErrCount += IG_PDF_terminate();

Use /Accusoft/ImageGear19-64/bin/ for 64-bit platforms.

Remarks:

To initialize the ImageGear PDF component it needs to be attached to the core ImageGear and then IG_PDF_initialize() function must be called.

For a multi-threaded application, you must call IG_PDF_initialize and IG_PDF_terminate in the main thread and in each worker thread which uses PDF component. See Single- and Multi-Threaded Applications for more information.

The following resource content is required by the ImageGear PDF component initialization routine:

Resource\PDF\CIDFont\ PDF CID fonts directory.
Resource\PDF\CMap\ PDF font CMaps directory.
Resource\PDF\Font\ PDF fonts directory.
Resource\PDF\Unicode\ PDF unicode mappings directory.
Resource\PS\ColorRendering\ Color rendering PostScript.
Resource\PS\ICCProfiles\ Directory containing the ICC profiles that allow using the Adobe® Color Engine® (ACE®). 
The profiles in this directory must be placed in the system folder named, which on Windows is named \Windows\System32\Color.
Resource\PS\Fonts\ PS fonts directory.
Resource\PS\ProcSet\ PostScript procedures.
Resource\PS\ps.vm A file for initializing the PostScript Interpreter's virtual memory.
Resource\PS\startupNORM.ps Startup PostScript program used to initialize the PostScript Interpreter.
Resource\PS\superatm.db Adobe® Type Manager® (ATM®) database used to substitute missing fonts.

ImageGear PDF component uses the following PDF global control parameters to locate resource content:

PDF.PDF_RESOURCE_PATH Path to the Resource\PDF directory
PDF.PS_RESOURCE_PATH Path to the Resource\PS directory
PDF.HOST_FONT_PATH Path to the system font directory
PDF.TMP_PATH Path to the TEMP directory

Examples provided below demonstrate setting and getting the value of PDF.PDF_RESOURCE_PATH control parameter.

 
Copy Code

// Path to the Resource\PDF directory.
char* szResourcePath = "C:\\PDF\\Resource\\PDF\\";

IG_gctrl_item_set("PDF.PDF_RESOURCE_PATH", AM_TID_MAKELP(AM_TID_CHAR), szResourcePath, (DWORD)strlen(szResourcePath) + 1, "");

 
Copy Code

// Get path to the Resource\PDF directory.
char szResourcePath[_MAX_PATH];

IG_gctrl_item_get("PDF.PDF_RESOURCE_PATH", NULL, (LPVOID)&szResourcePath, sizeof(szResourcePath) - 1, NULL, NULL, 0, NULL);

If the PDF global parameters are not defined, the ImageGear PDF Component behavior depends on the OS: