Render(RectangleF,Single) Метод (PdfPage)
Отрисовывает указанный прямоугольник PDF страницы с указанным масштабом.
Parameters
- rect
- Прямоугольник на PDF странице.
- scale
- Масштабный коэффициент.
Return Value
Отрисованное изображение этой страницы.
Вот пример, показывающий, как визуализировать область PDF страницы с разрешением 600x600 точек на дюйм:
''' <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;
}
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5