Applies the segments specified in pSegmentInfo to the specified bitmap, then compresses and inserts the resulting image into the PDF file in memory.
#include "ltwrappr.h"
L_INT LPDFCompressor::InsertSegments( pBitmap, uSegmentCnt, pSegmentInfo, bIsThereBackGround, rgbBackGroundColor)
Pointer to the LBitmapBase class that references the image to be inserted in the PDF file.
Number of elements in the pSegmentInfo parameter. It represents the number of segments that will be applied to pBitmap.
Pointer to the SEGMENTINFO structure that contains an array that has the information for each segment.
Flag that indicates whether to use the average background color to represent the background of the page in the PDF file. Possible values are:
Value | Meaning |
---|---|
TRUE | Use the average color to draw a background color in the generated PDF page before drawing the segments. |
FALSE | Leave the background of the PDF page untouched. |
Average background color. This parameter is ignored if bIsThereBackGround is FALSE.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
To insert the bitmap using MRC segmentation, use LPDFCompressor::InsertMRC.
This example inserts an image to pdf document with using user Segments.
L_INT LPDFCompressor__InsertSegmentsExample(LBitmapBase* pBitmap, L_UINT uSegmentCnt, LPSEGMENTINFO pSegmentInfo , COLORREF rgbBackGroundColor, L_BOOL bIsThereBackGround)
{
L_INT nRet;
LPDFCompressor Pdf;
nRet = Pdf.Init ();
if(nRet != SUCCESS)
return nRet;
nRet = Pdf.InsertSegments( pBitmap, uSegmentCnt, pSegmentInfo, bIsThereBackGround, rgbBackGroundColor);
if(nRet != SUCCESS)
{
Pdf.Free ();
return nRet;
}
nRet = Pdf.Write (MAKE_IMAGE_PATH(TEXT("Output.pdf")));
if(nRet != SUCCESS)
return nRet;
Pdf.Free();
return SUCCESS;
}