←Select platform

ColoredImageCompressionType Enumeration

Summary
Specifies the compression types for colored images.
Syntax
C#
Objective-C
C++/CLI
Java
Python
[SerializableAttribute()] 
[DataContractAttribute()] 
public enum ColoredImageCompressionType 
typedef NS_ENUM(NSInteger, LTColoredImageCompressionType) { 
 LTColoredImageCompressionTypeFlateJpeg,  
 LTColoredImageCompressionTypeLzwJpeg,  
 LTColoredImageCompressionTypeFlate,  
 LTColoredImageCompressionTypeLzw,  
 LTColoredImageCompressionTypeJpeg,  
 LTColoredImageCompressionTypeFlateJpx,  
 LTColoredImageCompressionTypeLzwJpx,  
 LTColoredImageCompressionTypeJpx 
}; 
public enum ColoredImageCompressionType 
[DataContractAttribute()] 
[SerializableAttribute()] 
public enum class ColoredImageCompressionType   
class ColoredImageCompressionType(Enum): 
   FlateJpeg = 0 
   LzwJpeg = 1 
   Flate = 2 
   Lzw = 3 
   Jpeg = 4 
   FlateJpx = 5 
   LzwJpx = 6 
   Jpx = 7 
Members
ValueMemberDescription
0FlateJpeg

Use JPEG compression for images which are more than 8BPP, or for grayscale 8BPP, else use flate compression.

1LzwJpeg

Use JPEG compression for images which are more than 8BPP, or for grayscale 8BPP, else use LZW compression.

2Flate

Use flate compression for compressing colored images.

3Lzw

Use LZW compression for compressing colored images.

4Jpeg

Use JPEG compression for compressing colored images.

5FlateJpx Use JPEG 2000 compression for images which are more than 8BPP, or for grayscale 8BPP, else use flate compression. Requires Leadtools.Codecs.J2k, Leadtools.Codecs.Tif and Leadtools.Codecs.Bmp
6LzwJpx Use JPEG 2000 compression for images which are more than 8BPP, or for grayscale 8BPP, else use LZW compression. Requires Leadtools.Codecs.J2k, Leadtools.Codecs.Tif and Leadtools.Codecs.Bmp
7Jpx Use JPEG 2000 compression for compressing colored images. Requires Leadtools.Codecs.J2k, Leadtools.Codecs.Tif and Leadtools.Codecs.Bmp
Remarks

You can use the ColoredImageCompressionType to control the compression type for colored images (i.e. images more than one bits per pixel) in the final document created by the LEADTOOLS Document Writer. The DocumentFormat.Pdf supports selecting compression types in the final document.

Use the PdfDocumentOptions.ColoredImageCompression property to control the compression type for colored images when creating PDF documents.

Example
C#
using Leadtools.Document.Writer; 
using Leadtools.Ocr; 
using Leadtools; 
using Leadtools.Codecs; 
 
 
public void PdfDocumentOptionsExample() 
{ 
   var inputFileName = Path.Combine(LEAD_VARS.ImagesDir, "test.docx"); 
   var outputFileName = Path.Combine(LEAD_VARS.ImagesDir, "Example.pdf"); 
 
   // Setup a new RasterCodecs object 
   var codecs = new RasterCodecs(); 
   codecs.Options.RasterizeDocument.Load.Resolution = 300; 
 
   // Get the number of pages in the input document 
   var pageCount = codecs.GetTotalPages(inputFileName); 
 
   // Create a new instance of the LEADTOOLS Document Writer 
   var docWriter = new DocumentWriter(); 
 
   // Change the PDF options 
   var pdfOptions = docWriter.GetOptions(DocumentFormat.Pdf) as PdfDocumentOptions; 
   pdfOptions.DocumentType = PdfDocumentType.Pdf; 
   pdfOptions.FontEmbedMode = DocumentFontEmbedMode.None; 
   pdfOptions.ImageOverText = false; 
   pdfOptions.Linearized = false; 
   pdfOptions.Title = "Add your title here"; 
   pdfOptions.Subject = "Add your subject here"; 
   pdfOptions.Keywords = "Add your keywords here"; 
   pdfOptions.Author = "Add author name here"; 
   pdfOptions.Protected = true; 
   pdfOptions.UserPassword = "User password"; 
   pdfOptions.OwnerPassword = "Owner password"; 
   pdfOptions.EncryptionMode = PdfDocumentEncryptionMode.RC128Bit; 
   pdfOptions.PrintEnabled = false; 
   pdfOptions.HighQualityPrintEnabled = true; 
   pdfOptions.CopyEnabled = false; 
   pdfOptions.EditEnabled = true; 
   pdfOptions.AnnotationsEnabled = true; 
   pdfOptions.AssemblyEnabled = false; 
   pdfOptions.OneBitImageCompression = OneBitImageCompressionType.Flate; 
   pdfOptions.ColoredImageCompression = ColoredImageCompressionType.FlateJpeg; 
   pdfOptions.QualityFactor = 2; 
 
   // Use default resolution 
   pdfOptions.DocumentResolution = 0; 
   pdfOptions.PageRestriction = DocumentPageRestriction.Relaxed; 
 
   // Setup empty page size (Letter size) 
   pdfOptions.EmptyPageWidth = 8.5; 
   pdfOptions.EmptyPageHeight = 11; 
   pdfOptions.EmptyPageResolution = 300; 
 
   docWriter.SetOptions(DocumentFormat.Pdf, pdfOptions); 
 
   // Create a new PDF document 
   Debug.WriteLine("Creating new PDF document: {0}", outputFileName); 
   docWriter.BeginDocument(outputFileName, DocumentFormat.Pdf); 
 
   // Loop through all the pages 
   for (var pageNumber = 1; pageNumber <= pageCount; pageNumber++) 
   { 
      // Get the page as SVG 
      Debug.WriteLine("Loading page {0}", pageNumber); 
      var page = new DocumentWriterSvgPage(); 
      page.SvgDocument = codecs.LoadSvg(inputFileName, pageNumber, null); 
 
      // Add the page 
      Debug.WriteLine("Adding page {0}", pageNumber); 
      docWriter.AddPage(page); 
 
      page.SvgDocument.Dispose(); 
   } 
 
   // Finally finish writing the PDF file on disk 
   docWriter.EndDocument(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

Leadtools.Document.Writer Assembly

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