VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Codecs.Encoders Namespace / PdfMrcEncoder Class
Members Example



In This Topic
    PdfMrcEncoder Class
    In This Topic
    Defines an encoder that uses the Mixed Raster Content (MRC) lossy compression for encoding PDF documents.
    Object Model
    PdfMrcEncoder ClassPdfFormat ClassPdfMrcCompressionSettings ClassPdfEncoderSettings Class
    Syntax
    'Declaration
     
    Public Class PdfMrcEncoder 
       Inherits PdfEncoder
       Implements IPdfEncoder 
    public class PdfMrcEncoder : PdfEncoder, IPdfEncoder  
    public __gc class PdfMrcEncoder : public PdfEncoder, IPdfEncoder  
    public ref class PdfMrcEncoder : public PdfEncoder, IPdfEncoder  
    Example
    This example shows how to encode images to PDF format using MRC compression:
    Public Shared Sub EncodeImagesUseMrc(images As Vintasoft.Imaging.ImageCollection, pdfFilename As String)
    	' create PDF MRC encoder
    	Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.PdfMrcEncoder()
                
    	' set MRC compression settings
    	SetCompressionSettings(encoder.MrcCompressionSettings)
                
    	' save images to PDF use MRC compression
    	images.SaveSync(pdfFilename, encoder)
    End Sub
                
    Private Shared Sub SetCompressionSettings(settings As Vintasoft.Imaging.Codecs.Encoders.PdfMrcCompressionSettings)
    	' background layer
    	settings.CreateBackgroundLayer = True
    	settings.BackgroundLayerCompression = Vintasoft.Imaging.Pdf.PdfCompression.Jpeg Or Vintasoft.Imaging.Pdf.PdfCompression.Zip
    	settings.BackgroundLayerCompressionSettings.JpegQuality = 35
                
    	' images layer, images placed to background layer
    	settings.ImageSegmentation = New Vintasoft.Imaging.ImageProcessing.Info.ImageSegmentationCommand()
    	settings.CreateImagesLayer = False
                
    	' mask layer
    	settings.HiQualityMask = True
    	settings.MaskCompression = Vintasoft.Imaging.Pdf.PdfCompression.Jbig2
    	settings.MaskCompressionSettings.Jbig2Settings.Lossy = True
                
    	' front layer
    	settings.CreateFrontLayer = True
    	settings.HiQualityFrontLayer = True
    	settings.FrontLayerCompression = Vintasoft.Imaging.Pdf.PdfCompression.Jpeg Or Vintasoft.Imaging.Pdf.PdfCompression.Zip
    	settings.FrontLayerCompressionSettings.JpegQuality = 25
    End Sub
    public static void EncodeImagesUseMrc(Vintasoft.Imaging.ImageCollection images, string pdfFilename)
    {
        // create PDF MRC encoder
        Vintasoft.Imaging.Codecs.Encoders.PdfMrcEncoder encoder = 
            new Vintasoft.Imaging.Codecs.Encoders.PdfMrcEncoder();
        
        // set MRC compression settings
        SetCompressionSettings(encoder.MrcCompressionSettings);
        
        // save images to PDF use MRC compression
        images.SaveSync(pdfFilename, encoder);
    }
                
    private static void SetCompressionSettings(Vintasoft.Imaging.Codecs.Encoders.PdfMrcCompressionSettings settings)
    {
        // background layer
        settings.CreateBackgroundLayer = true;
        settings.BackgroundLayerCompression = 
            Vintasoft.Imaging.Pdf.PdfCompression.Jpeg | Vintasoft.Imaging.Pdf.PdfCompression.Zip;
        settings.BackgroundLayerCompressionSettings.JpegQuality = 35;
                
        // images layer, images placed to background layer
        settings.ImageSegmentation = 
            new Vintasoft.Imaging.ImageProcessing.Info.ImageSegmentationCommand();
        settings.CreateImagesLayer = false;
                
        // mask layer
        settings.HiQualityMask = true;
        settings.MaskCompression = Vintasoft.Imaging.Pdf.PdfCompression.Jbig2;
        settings.MaskCompressionSettings.Jbig2Settings.Lossy = true;
                
        // front layer
        settings.CreateFrontLayer = true;
        settings.HiQualityFrontLayer = true;
        settings.FrontLayerCompression = 
            Vintasoft.Imaging.Pdf.PdfCompression.Jpeg | 
            Vintasoft.Imaging.Pdf.PdfCompression.Zip;
        settings.FrontLayerCompressionSettings.JpegQuality = 25;
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.Codecs.Encoders.EncoderBase
          Vintasoft.Imaging.Codecs.Encoders.MultipageEncoderBase
             Vintasoft.Imaging.Codecs.Encoders.PdfEncoder
                Vintasoft.Imaging.Codecs.Encoders.PdfMrcEncoder

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also