←Select platform

PdfCompressorPictureCompression Enumeration

Summary
Flags that identify the Compression type to be used for Picture images.

Syntax
C#
C++/CLI
Python
public enum PdfCompressorPictureCompression   
public enum class PdfCompressorPictureCompression   
class PdfCompressorPictureCompression(Enum): 
   JpgPic = 0 
   Jpg422Pic = 1 
   Jpg411Pic = 2 
   JpgProgressivePic = 3 
   Jpg422ProgressivePic = 4 
   Jpg411ProgressivePic = 5 
   ZipPic = 6 
   LzwPic = 7 
   JpxPic = 8 
Members
ValueMemberDescription
0JpgPic Use JPEG 444 compression.
1Jpg422Pic Use JPEG 422 compression.
2Jpg411Pic Use JPEG 411 compression.
3JpgProgressivePic Use JPEG 444 Progressive compression.
4Jpg422ProgressivePic Use JPEG 422 Progressive compression.
5Jpg411ProgressivePic Use JPEG 411 Progressive compression.
6ZipPic Use ZIP compression.
7LzwPic Use LZW compression.
8JpxPic Use JPEG 2000 Part 2 (JPX).
Example
C#
using Leadtools; 
using Leadtools.PdfCompressor; 
using Leadtools.Codecs; 
 
 
public void pdfCompressor_SegmentImage_PdfDocument(object sender, PdfCompressorSegmentImageEventArgs e) 
{ 
   //This will prevent addition to any segment with type background in all pages except the first page only 
   if (e.Page != 0 && e.Segment.Type == SegmentTypeFlags.Background) 
      e.Cancel = true; 
   else 
      e.Cancel = false; 
 
} 
 
public void PdfCompressorExample_PdfDocument() 
{ 
   // Load an image 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "MRCSegmentation.mrc")); 
 
   PdfCompressorEngine pdfCompressor = new PdfCompressorEngine(); 
   PdfCompressorCompressionTypes compressionTypes = new PdfCompressorCompressionTypes(); 
 
   //Sets compression types needed for each segment 
   compressionTypes.Comp1Bit = PdfCompressor1BitCompression.Zip1Bit; 
   compressionTypes.Comp2Bit = PdfCompressor2BitCompression.Lzw2Bit; 
   compressionTypes.CompPicture = PdfCompressorPictureCompression.JpgPic; 
   compressionTypes.QFactor = 2; 
   //Flags for used compression types should be set 
   compressionTypes.Flags = EnabledCompressionsFlags.EnableOneBit | 
      EnabledCompressionsFlags.EnableTwoBit | 
      EnabledCompressionsFlags.EnablePicture; 
 
   pdfCompressor.SetCompression(compressionTypes); 
 
   pdfCompressor.Insert(image); 
   pdfCompressor.SegmentImage += new EventHandler<PdfCompressorSegmentImageEventArgs>(pdfCompressor_SegmentImage_PdfDocument); 
   pdfCompressor.Write(Path.Combine(LEAD_VARS.ImagesDir, "Out_Image.pdf")); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.PdfCompressor Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.