VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Codecs.Decoders Namespace / IVectorDecoder Interface
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
IVectorDecoder Interface
In This Topic
Defines an interface for vector decoder.
Object Model
IVectorDecoder
Syntax
'Declaration

Public Interface IVectorDecoder

public interface IVectorDecoder

Example

Here is an example that shows how to get the central region of PDF page which is 4x upscaled:


''' <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);
        }
    }
}

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also