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 LPDFCompressorKid : public LPDFCompressor 
{
protected: 
   L_INT ImageCallBack(L_INT nPage, LPSEGMENTINFO pSegment) 
   {
      if(pSegment->uSegmentType == SEGMENT_BACKGROUND) 
         return FAILURE; 
      else
         return SUCCESS; 
   }
};
void PdfcompressorinsertnormalExample()
{
   LPDFCompressorKid pdf ; 
   L_INT nRet; 
   LBitmap LEADBitmap ; 
   PDFCOMPOPTIONS PDFOptions; 
   memset(&PDFOptions,0,sizeof(&PDFOptions)); 

   nRet = pdf.Init ();
   if (nRet != SUCCESS) 
   {
      MessageBox("Couldn't initialize pdf compressor") ; 
      return ; 
   }
   
   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; 
   
   if (LEADBitmap.Load(TEXT("C:\\IMAGE4.CMP")) != SUCCESS) 
   {
      MessageBox(TEXT("Failed to load source image \"C:\\IMAGE4.CMP\""));
      pdf.Free ();
      return ; 
   }
   nRet = pdf.InsertNormal(&LEADBitmap); 
   
   nRet = pdf.Write (TEXT("C:\\Output(InsertNormal).pdf"));
   if (nRet ==SUCCESS) 
      MessageBox(TEXT("result saved to C:\\Output(InsertNormal).pdf"));
   else
      MessageBox(TEXT("failed to save result"));
   
   pdf.Free ();
}