DecodingSettings Свойство (PdfDocument)
Возвращает или задает настройки для декодирования страниц этого PDF документа.
Вот пример, показывающий, как отобразить PDF страницу с включенным управлением цветом:
''' <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;
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5