VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / DecodingSettings Property
Example



In This Topic
    DecodingSettings Property (PdfDocument)
    In This Topic
    Gets or sets settings for decoding of pages of this PDF document.
    Syntax
    'Declaration
     
    Public Property DecodingSettings As DecodingSettings
    public DecodingSettings DecodingSettings {get; set;}
    public: __property DecodingSettings* get_DecodingSettings();
    public: __property void set_DecodingSettings( 
       DecodingSettings* value
    );
    public:
    property DecodingSettings^ DecodingSettings {
       DecodingSettings^ get();
       void set (    DecodingSettings^ value);
    }
    Example
    This example shows how to render a PDF page with enabled color management.
    ''' <summary>
    ''' Renders PDF page with enabled color management.
    ''' </summary>
    ''' <param name="page">The PDF page.</param>
    ''' <param name="iccProfile">The ICC profile that should be applied to PDF page.</param>
    Public Shared Function RenderPdfPageWithEnabledColorManagement(page As Vintasoft.Imaging.Pdf.Tree.PdfPage, iccProfile As Vintasoft.Imaging.ColorManagement.Icc.IccProfile) As Vintasoft.Imaging.VintasoftImage
    	' if decoding settings are NOT specified
    	If page.Document.DecodingSettings Is Nothing Then
    		' create the default decoding settings
    		page.Document.DecodingSettings = New Vintasoft.Imaging.Codecs.Decoders.DecodingSettings()
    	End If
                
    	' get the decoding setting of PDF document
    	Dim decodingSettings As Vintasoft.Imaging.Codecs.Decoders.DecodingSettings = page.Document.DecodingSettings
    	' if color management decoding settings is NOT enabled
    	If decodingSettings.ColorManagement Is Nothing Then
    		' create the default color management decoding settings
    		decodingSettings.ColorManagement = New Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings()
    	End If
                
    	' set the ICC profile that should be applied to PDF page
    	decodingSettings.ColorManagement.InputCmykProfile = iccProfile
                
    	' render PDF page
    	Dim image As Vintasoft.Imaging.VintasoftImage = page.Render()
                
    	' return the image of PDF page
    	Return image
    End Function
    /// <summary>
    /// Renders PDF page with enabled color management.
    /// </summary>
    /// <param name="page">The PDF page.</param>
    /// <param name="iccProfile">The ICC profile that should be applied to PDF page.</param>
    public static Vintasoft.Imaging.VintasoftImage RenderPdfPageWithEnabledColorManagement(
        Vintasoft.Imaging.Pdf.Tree.PdfPage page, 
        Vintasoft.Imaging.ColorManagement.Icc.IccProfile iccProfile)
    {
        // if decoding settings are NOT specified
        if (page.Document.DecodingSettings == null)
            // create the default decoding settings
            page.Document.DecodingSettings = new Vintasoft.Imaging.Codecs.Decoders.DecodingSettings();
                
        // get the decoding setting of PDF document
        Vintasoft.Imaging.Codecs.Decoders.DecodingSettings decodingSettings = page.Document.DecodingSettings;
        // if color management decoding settings is NOT enabled
        if (decodingSettings.ColorManagement == null)
            // create the default color management decoding settings
            decodingSettings.ColorManagement = new Vintasoft.Imaging.ColorManagement.ColorManagementDecodeSettings();
                
        // set the ICC profile that should be applied to PDF page
        decodingSettings.ColorManagement.InputCmykProfile = iccProfile;
                
        // render PDF page
        Vintasoft.Imaging.VintasoftImage image = page.Render();
                
        // return the image of PDF page
        return image;
    }
    Requirements

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

    See Also