LPDFCompressor::InsertNormal

#include "ltwrappr.h"

#include "LTCPDFComp.h"

L_INT LPDFCompressor::InsertNormal(pBitmap)

LBitmapBase * pBitmap;

/* pointer to an LBitmapBase object */

Compresses the specified image, without segmenting it, and inserts the image in the PDF file in memory.

Parameter

Description

pBitmap

Pointer to the bitmap handle that references the image to be inserted in the PDF document.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

To segment an image using MRC segmentation, compress it, and insert the bitmap to the PDF file in memory, call LPDFCompressor::InsertMRC.

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:

LPDFCompressor::InsertMRC, Class Members

Topics:

Creating a Compressed PDF File

 

Class Library Function Groups

Example

This example inserts an image in a pdf document without using MRC segmentation.

class LPDFCompressorKidIN : public LPDFCompressor 
{
protected: 
   L_INT ImageCallBack(L_INT nPage, LPSEGMENTINFO pSegment) 
   {
      UNREFERENCED_PARAMETER(nPage);
      if(pSegment->uSegmentType == SEGTYPE_BACKGROUND)
         return FAILURE;
      else
         return SUCCESS; 
   }
};
L_INT LPDFCompressor__InsertNormalExample()
{
   LPDFCompressorKidIN  pdf;
   L_INT                nRet;
   LBitmap              LEADBitmap;
   PDFCOMPOPTIONS       PDFOptions; 
   memset(&PDFOptions,0,sizeof(&PDFOptions)); 
   nRet = pdf.Init ();
   if (nRet != SUCCESS) 
   {
      MessageBox(NULL, TEXT("Couldn't initialize pdf compressor"), TEXT("Error"), MB_OK) ; 
      return nRet;
   }
   PDFOptions.imageQuality = PDFCOMP_IMAGEQUALITY_USER; 
   PDFOptions.outputQuality = PDFCOMP_OUTPUTQUALITY_USER; 
   PDFOptions.uCleanSize = 7;
   PDFOptions.uBackGroundThreshold = 15; 
   PDFOptions.uCombineThreshold = 100; 
   PDFOptions.uSegmentQuality = 50; 
   PDFOptions.uColorThreshold = 25; 
   nRet = LEADBitmap.Load(TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\IMAGE4.CMP"));
   if(nRet != SUCCESS)
   {
      MessageBox(NULL, TEXT("Failed to load source image \"C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\IMAGE4.CMP\""), TEXT("Error"), MB_OK) ; 
      pdf.Free ();
      return nRet;
   }
   nRet = pdf.InsertNormal(&LEADBitmap); 
   if(nRet != SUCCESS)
      return nRet;
   nRet = pdf.Write (TEXT("C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\Output(InsertNormal).pdf"));
   if (nRet ==SUCCESS) 
      MessageBox(NULL, TEXT("result saved to C:\\Program Files\\LEAD Technologies, Inc\\LEADTOOLS 15.0\\Images\\Output(InsertNormal).pdf"), TEXT("Error"), MB_OK) ; 
   else
   {
      MessageBox(NULL, TEXT("failed to save result"), TEXT("Error"), MB_OK) ; 
      return nRet;
   }
   pdf.Free ();
   return SUCCESS;
}