VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Pdf.Tree Namespace / PdfPage Class / Render Method / Render(EventHandler<ProgressEventArgs>) Method
An image rendering progress delegate.
Example



In This Topic
    Render(EventHandler<ProgressEventArgs>) Method
    In This Topic
    Returns the rendered image of the page.
    Syntax

    Parameters

    renderingProgress
    An image rendering progress delegate.

    Return Value

    Rendered image of the page.
    Example
    This example shows how to render a PDF page with progress indication and cancel the rendering process at 80% level.
    ''' <summary>
    ''' Cancels rendering of PDF page when progress of rendering is greater than 80%.
    ''' </summary>
    ''' <param name="page">The page of PDF document.</param>
    Public Shared Sub CancelRenderingExample(page As Vintasoft.Imaging.Pdf.Tree.PdfPage)
        ' render image of PDF page
        page.Render(New System.EventHandler(Of Vintasoft.Imaging.ProgressEventArgs)(AddressOf RenderingProgress))
    End Sub
                
    ''' <summary>
    ''' Event handler of rendering progress.
    ''' </summary>
    Public Shared Sub RenderingProgress(sender As Object, e As Vintasoft.Imaging.ProgressEventArgs)
        ' if rendering canbe canceled and rendering progress is geater than 80%
        If e.CanCancel AndAlso e.Progress >= 80 Then
            ' cancel rendering
            e.Cancel = True
        End If
    End Sub
    /// <summary>
    /// Cancels rendering of PDF page when progress of rendering is greater than 80%.
    /// </summary>
    /// <param name="page">The page of PDF document.</param>
    public static void CancelRenderingExample(Vintasoft.Imaging.Pdf.Tree.PdfPage page)
    {
        // render image of PDF page
        page.Render(new System.EventHandler<Vintasoft.Imaging.ProgressEventArgs>(RenderingProgress));
    }
                
    /// <summary>
    /// Event handler of rendering progress.
    /// </summary>
    public static void RenderingProgress(object sender, Vintasoft.Imaging.ProgressEventArgs e)
    {
        // if rendering canbe canceled and rendering progress is geater than 80%
        if (e.CanCancel && e.Progress >= 80)
            // cancel rendering
            e.Cancel = true;
    }
    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also