VintaSoft Imaging .NET SDK 12.3: Documentation for .NET developer
Vintasoft.Imaging.Pdf Namespace / PdfDocument Class / DecodingSettings Property
Syntax Example Requirements SeeAlso
In This Topic
    DecodingSettings Property (PdfDocument)
    In This Topic
    Gets or sets settings for decoding of pages of this PDF document.
    Syntax
    Example

    Here is an example that 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: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also