#include "l_bitmap.h"
#include "lpdfComp.h"
L_LCMRC_API L_INT L_PdfCompInsertNormal(hDocHandle, pBitmap)
Compresses the specified image, without segmenting it, and inserts the image in the PDF file in memory.
Handle to an existing PDF document. This handle is obtained by calling the L_PdfCompInit function.
Pointer to the bitmap handle that references the image to be inserted in the PDF document.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To segment an image using MRC segmentation, compress it, and insert the bitmap to the PDF file in memory, call L_PdfCompInsertMRC.
Required DLLs and Libraries
This example inserts an image to pdf document without using the MRC.
L_INT PdfCompInsertNormalExample(L_VOID)
{
L_INT nRet;
BITMAPHANDLE hBitmap;
LCPDF_HANDLE hDocument;
nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("Image1.CMP")), &hBitmap,sizeof(BITMAPHANDLE),0,ORDER_RGB,NULL,NULL);
if(nRet != SUCCESS)
{
return nRet;
}
nRet = L_PdfCompInit (&hDocument,NULL,NULL);
if(nRet != SUCCESS)
{
return nRet;
}
nRet = L_PdfCompInsertNormal(hDocument,&hBitmap);
if(nRet != SUCCESS)
{
L_PdfCompFree (hDocument);
return nRet;
}
nRet = L_PdfCompWrite (hDocument,MAKE_IMAGE_PATH(TEXT("Output.pdf")));
L_PdfCompFree (hDocument);
L_FreeBitmap (&hBitmap);
return nRet;
}