UserSegmentInfo Example for Visual Basic
Dim WithEvents LeadPDFComp As LEADPDFCompressor
Dim Factory As New LEADRasterFactory
Dim Raster As LEADRaster
Dim RasterIO As New LEADRasterIO
Dim gszLic As String
Private Sub Form_Load()
gszLic = "LEADTOOLS OCX Copyright (c) 1991-2005 LEAD Technologies, Inc."
Set LeadPDFComp = New LEADPDFCompressor
Set Raster = Factory.CreateObject ("LEADRaster.LEADRaster", gszLic)
RasterIO.Load Raster, "C:\Image.cmp", 0, 0, 1
LeadPDFComp.PDFCompInit False
LeadPDFComp.UserSegmentInfoCount = 2
LeadPDFComp.UserSegmentInfo(0).SegmentTop = 0
LeadPDFComp.UserSegmentInfo(0).SegmentLeft = 0
LeadPDFComp.UserSegmentInfo(0).SegmentBottom = Raster.BitmapHeight / 2
LeadPDFComp.UserSegmentInfo(0).SegmentRight = Raster.BitmapWidth / 2
LeadPDFComp.UserSegmentInfo(0).SegmentType = PDFCOMP_SEGMENT_TYPE_PICTURE
LeadPDFComp.UserSegmentInfo(0).SegmentColorsCount = 0
LeadPDFComp.UserSegmentInfo(1).SegmentTop = Raster.BitmapHeight / 2
LeadPDFComp.UserSegmentInfo(1).SegmentLeft = Raster.BitmapHeight / 2
LeadPDFComp.UserSegmentInfo(1).SegmentBottom = Raster.BitmapHeight
LeadPDFComp.UserSegmentInfo(1).SegmentRight = Raster.BitmapWidth
LeadPDFComp.UserSegmentInfo(1).SegmentType = PDFCOMP_SEGMENT_TYPE_PICTURE
LeadPDFComp.UserSegmentInfo(1).SegmentColorsCount = 0
LeadPDFComp.PDFCompInsertSegments Raster, vbWhite, True
LeadPDFComp.PDFCompWrite "C:\Output.pdf"
LeadPDFComp.PDFCompFree
End Sub