TIOParams.PDF_Compression
Declaration
property PDF_Compression: TIOPDFCompression;
Description
Specifies the compression filter for image saved in an Adobe PDF file.
Note:
◼This property is only used when saving PDF files natively, e.g. using
TImageEnIO.SaveToFilePDF or
TImageEnMIO.SaveToFilePDF (and the
PdfViewer is disabled). It is NOT used when saving with
PDFium◼Monochrome images (
BitsPerSample and
SamplesPerPixel = 1) do not support ioPDF_JPEG. If specified, ioPDF_G4FAX will be used instead
◼Color images do not support ioPDF_RLE, ioPDF_G4FAX or ioPDF_G3FAX2D. If specified, ioPDF_UNCOMPRESSED will be used instead
◼If your image contains transparency (
HasAlphaChannel = True) and is not monochrome, use ioPDF_LZW or ioPDF_UNCOMPRESSED to include it in the PDF. ioPDF_JPEG can also be used but artifacts may be visible. The Alpha channel makes the file size much larger, so you may want to
remove it◼For ioPDF_JPEG, you can specify the JPEG quality and other properties using:
JPEG_Quality,
JPEG_Smooth,
JPEG_ColorSpace,
JPEG_DCTMethod,
JPEG_OptimalHuffman◼If you are using a
TIEMultiBitmap or
TImageEnMView, you can use
DuplicateCompressionInfo to propogate the parameter to all frames
Default: ioPDF_G4FAX (if the image is color, it will default to ioPDF_UNCOMPRESSED)
// Convert monochrome TIFF to PDF
ImageEnView1.IO.LoadFromFile('D:\input.tif');
ImageEnView1.IO.Params.PDF_Compression := ioPDF_G4FAX;
ImageEnView1.IO.SaveToFile('D:\output.pdf');
// Convert full color PNG to PDF
ImageEnView1.IO.LoadFromFile('D:\input.png');
ImageEnView1.IEBitmap.RemoveAlphaChannel( True ); // Discard any alpha channel if not needed to reduce file size
ImageEnView1.IO.Params.PDF_PaperSize := iepA4;
ImageEnView1.IO.Params.PDF_Compression := ioPDF_JPEG;
ImageEnView1.IO.Params.JPEG_Quality := 90;
ImageEnView1.IO.SaveToFile('D:\out.pdf');