VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
Vintasoft.Imaging.Codecs.Decoders Namespace / IVectorDecoder Interface
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
IVectorDecoder Интерфейс
В этом разделе
Определяет интерфейс для векторного декодера.
Объектаня модель
IVectorDecoder
Синтаксис
'Declaration

Public Interface IVectorDecoder

public interface IVectorDecoder

Пример

Вот пример, показывающий, как получить центральную область PDF страницы, увеличенную в 4 раза:


''' <summary>
''' Returns an enlarged image of the central region of PDF page.
''' </summary>
Public Shared Function GetEnlargedImageOfPdfPageRegion(filename As String, pageIndex As Integer) As Vintasoft.Imaging.VintasoftImage
    Using stream As System.IO.Stream = New System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
        Using decoder As New Vintasoft.Imaging.Codecs.Decoders.PdfDecoder(stream)
            ' settings for page rendering
            Dim renderingSettings As Vintasoft.Imaging.Codecs.Decoders.RenderingSettings = Vintasoft.Imaging.Codecs.Decoders.RenderingSettings.Empty
            ' get page info
            Dim pageInfo As Vintasoft.Imaging.Codecs.Decoders.ImageInfo = decoder.GetImageInfo(pageIndex, renderingSettings, Nothing)

            ' determine region on page
            Dim x As Single = 3F * pageInfo.Width / 8F
            Dim y As Single = 3F * pageInfo.Height / 8F
            Dim width As Single = pageInfo.Width / 4F
            Dim height As Single = pageInfo.Height / 4F
            Dim rect As New System.Drawing.RectangleF(x, y, width, height)

            ' get the central region with size of 1/4 page and scale 4
            Return decoder.GetImage(pageIndex, rect, 4F, Nothing, renderingSettings, Nothing, _
                Nothing)
        End Using
    End Using
End Function


/// <summary>
/// Returns an enlarged image of the central region of PDF page.
/// </summary>
public static Vintasoft.Imaging.VintasoftImage GetEnlargedImageOfPdfPageRegion(string filename, int pageIndex)
{
    using (System.IO.Stream stream =
        new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
    {
        using (Vintasoft.Imaging.Codecs.Decoders.PdfDecoder decoder =
            new Vintasoft.Imaging.Codecs.Decoders.PdfDecoder(stream))
        {
            // settings for page rendering
            Vintasoft.Imaging.Codecs.Decoders.RenderingSettings renderingSettings =
                Vintasoft.Imaging.Codecs.Decoders.RenderingSettings.Empty;
            // get page info
            Vintasoft.Imaging.Codecs.Decoders.ImageInfo pageInfo = decoder.GetImageInfo(pageIndex, renderingSettings, null);

            // determine region on page
            float x = 3f * pageInfo.Width / 8f;
            float y = 3f * pageInfo.Height / 8f;
            float width = pageInfo.Width / 4f;
            float height = pageInfo.Height / 4f;
            System.Drawing.RectangleF rect = new System.Drawing.RectangleF(x, y, width, height);

            // get the central region with size of 1/4 page and scale 4
            return decoder.GetImage(pageIndex, rect, 4f, null, renderingSettings, null, null);
        }
    }
}

Требования

Целевые платформы: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также