Defines an interface for vector decoder.
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);
}
}
}
Target Platforms: .NET9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5