VintaSoft Imaging .NET SDK 14.0: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPage Class / Render Methods / Render(RectangleF,Single) Method
Syntax Example Requirements SeeAlso
In This Topic
    Render(RectangleF,Single) Method (PdfPage)
    In This Topic
    Renders specified rectangle of PDF page with specified scale.
    Syntax

    Parameters

    rect
    Rectangle on PDF page.
    scale
    Scale factor.

    Return Value

    Rendered image of this page.
    Example

    Here is an example that shows how to render a PDF page region with 600x600 dpi resolution:

    
    ''' <summary>
    ''' Gets region of PDF page with 600x600 resolution.
    ''' </summary>
    ''' <param name="page">The page of PDF document.</param>
    ''' <param name="region">The region of page.</param>
    Public Shared Function GetImage600dpiRegion(page As Vintasoft.Imaging.Pdf.Tree.PdfPage, region As System.Drawing.RectangleF) As Vintasoft.Imaging.VintasoftImage
        ' get the rendering settings of PDF document
        Dim renderingSettings As Vintasoft.Imaging.Codecs.Decoders.PdfRenderingSettings = page.Document.RenderingSettings
        ' save previous resolution of rendering settings
        Dim prevResolution As Vintasoft.Imaging.Resolution = renderingSettings.Resolution
        ' set new resolution for image rendering
        renderingSettings.Resolution = New Vintasoft.Imaging.Resolution(600, 600)
    
        ' render region of PDF page
        Dim image As Vintasoft.Imaging.VintasoftImage = page.Render(region, 1F)
    
        ' restore resolution of rendering settings
        renderingSettings.Resolution = prevResolution
    
        ' return the image
        Return image
    End Function
    
    
    
    /// <summary>
    /// Gets region of PDF page with 600x600 resolution.
    /// </summary>
    /// <param name="page">The page of PDF document.</param>
    /// <param name="region">The region of page.</param>
    public static Vintasoft.Imaging.VintasoftImage GetImage600dpiRegion(
        Vintasoft.Imaging.Pdf.Tree.PdfPage page, System.Drawing.RectangleF region)
    {
        // get the rendering settings of PDF document
        Vintasoft.Imaging.Codecs.Decoders.PdfRenderingSettings renderingSettings = page.Document.RenderingSettings;
        // save previous resolution of rendering settings
        Vintasoft.Imaging.Resolution prevResolution = renderingSettings.Resolution;
        // set new resolution for image rendering
        renderingSettings.Resolution = new Vintasoft.Imaging.Resolution(600, 600);
    
        // render region of PDF page
        Vintasoft.Imaging.VintasoftImage image = page.Render(region, 1.0f);
    
        // restore resolution of rendering settings
        renderingSettings.Resolution = prevResolution;
    
        // return the image
        return image;
    }
    
    

    Requirements

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

    See Also