LEADTOOLS Mixed Raster Content (MRC) C DLL Help > Function References > L_PdfCompInsertSegments |
#include "l_bitmap.h"
#include "lpdfComp.h"
L_LCMRC_API L_INT L_PdfCompInsertSegments(hDocHandle, pBitmap, uSegmentCnt, pSegmentInfo, bIsThereBackGround, rgbBackGroundColor);
LCPDF_HANDLE hDocHandle; |
/* handle to an existing PDF document */ |
pBITMAPHANDLE pBitmap; |
/* pointer to a bitmap handle */ |
L_UINT uSegmentCnt; |
/* number of elements in segment array */ |
LPSEGMENTINFO pSegmentInfo; |
/* pointer to the SEGMENTINFO structure */ |
L_BOOL bIsThereBackGround; |
/* flag */ |
COLORREF rgbBackGroundColor; |
/* background color */ |
Applies the segments specified in pSegmentInfo to the specified bitmap, then compresses and inserts the resulting image into the PDF file in memory.
Parameter |
Description |
|
hDocHandle |
Handle to an existing PDF document. This handle is obtained by calling the L_PdfCompInit function. |
|
pBitmap |
Pointer to the bitmap handle that references the image to be inserted in the PDF file. |
|
uSegmentCnt |
Number of elements in the pSegmentInfo parameter. It represents the number of segments that will be applied to pBitmap. |
|
pSegmentInfo |
Pointer to the SEGMENTINFO structure that contains an array that has the information for each segment. |
|
bIsThereBackGround |
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. |
rgbBackGroundColor |
Average background color. This parameter is ignored if bIsThereBackGround is FALSE. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
To insert the bitmap using MRC segmentation, use L_PdfCompInsertMRC.
Required DLLs and Libraries
LCMRC 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: |
L_PdfCompInsertMRC, L_PDFCompInsertNormal, L_PDFCompSetCompression |
Topics: |
|
|
Example
This example inserts an image to pdf document with using user Segments.
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName L_INT PdfCompInsertSegmentsExample(pBITMAPHANDLE pBitmap, L_UINT uSegmentCnt, LPSEGMENTINFO pSegmentInfo, COLORREF rgbBackGroundColor, L_BOOL bIsThereBackGround) { L_INT nRet; LCPDF_HANDLE hDocument; nRet = L_PdfCompInit(&hDocument,NULL,NULL); if(nRet != SUCCESS) { return nRet; } nRet = L_PdfCompInsertSegments( hDocument, pBitmap, uSegmentCnt, pSegmentInfo, bIsThereBackGround, rgbBackGroundColor); if(nRet != SUCCESS) { L_PdfCompFree(hDocument); return nRet; } nRet = L_PdfCompWrite (hDocument, MAKE_IMAGE_PATH(TEXT("Output.pdf"))); if(nRet != SUCCESS) return nRet; L_PdfCompFree (hDocument); return SUCCESS; }