Leadtools.Document Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
DrawPage Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : DrawPage Method




Draws the specified page with(out) its zones, at any size, to a Graphics object. If the display surface has fewer colors than the image, this method dithers the output to that display surface without affecting the actual image data.

Overload List

OverloadDescription
DrawPage(Graphics,Int32,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties) Draws the specified page with(out) its zones, at any size, to a Graphics object. If the display surface has fewer colors than the image, this method dithers the output to that display surface without affecting the actual image data.  
DrawPage(IntPtr,Int32,Rectangle,Rectangle,Rectangle,Rectangle,RasterPaintProperties) Draws the specified page with(out) its zones, at any size, to a Graphics object. If the display surface has fewer colors than the image, this method dithers the output to that display surface without affecting the actual image data.  

Example

Visual BasicCopy Code
Public Sub DrawPageExample(ByVal graph As Graphics)
   ' Note that this is a sample key, which will not work in your toolkit
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")

   Dim rasterDocument As RasterDocumentEngine
   rasterDocument = RasterDocumentEngine.Instance
   rasterDocument.Startup()
   'assume page is added, refer to AddPage example for more information

   rasterDocument.ActivePage = 0
   Dim drawZoneOpts As RasterDocumentDrawZoneOptions = rasterDocument.DrawZoneOptions
   drawZoneOpts.Visible = True

   Dim zonePen As Pen = New Pen(System.Drawing.Color.Blue, 3)
   zonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid

   Dim selZonePen As Pen = New Pen(System.Drawing.Color.Red, 3)
   selZonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid

   drawZoneOpts.Pen = zonePen
   drawZoneOpts.SelectedPen = selZonePen
   drawZoneOpts.Offset = New Point(0, 0)
   drawZoneOpts.ZoomPercent = 100
   rasterDocument.DrawZoneOptions = drawZoneOpts

   Dim srcRect As Rectangle = New Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height)
   Dim srcClipRect As Rectangle = New Rectangle(0, 0, 0, 0)
   Dim dstRect As Rectangle = New Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height)
   Dim dstClipRect As Rectangle = New Rectangle(0, 0, 0, 0)

   rasterDocument.DrawPage(graph, 0, srcRect, srcClipRect, dstRect, dstClipRect, RasterPaintProperties.Default)
   rasterDocument.SelectZone(graph, 0, 0, True)

   rasterDocument.Shutdown()
End Sub
C#Copy Code
public void DrawPageExample(Graphics graph) 

   // Note that this is a sample key, which will not work in your toolkit 
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey"); 
 
   RasterDocumentEngine rasterDocument; 
   rasterDocument = RasterDocumentEngine.Instance; 
   rasterDocument.Startup(); 
 
   // assume page is added, refer to AddPage example for more information 
 
   rasterDocument.ActivePage = 0; 
   RasterDocumentDrawZoneOptions drawZoneOpts = rasterDocument.DrawZoneOptions; 
   drawZoneOpts.Visible = true; 
 
   Pen zonePen = new Pen(System.Drawing.Color.Blue, 3); 
   zonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; 
 
   Pen selZonePen = new Pen(System.Drawing.Color.Red, 3); 
   selZonePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid; 
 
   drawZoneOpts.Pen = zonePen; 
   drawZoneOpts.SelectedPen = selZonePen; 
   drawZoneOpts.Offset = new Point(0, 0); 
   drawZoneOpts.ZoomPercent = 100; 
   rasterDocument.DrawZoneOptions = drawZoneOpts; 
 
   Rectangle srcRect = new Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height); 
   Rectangle srcClipRect = new Rectangle(0, 0, 0, 0); 
   Rectangle dstRect = new Rectangle(0, 0, rasterDocument.GetPageInfo(0).Size.Width, rasterDocument.GetPageInfo(0).Size.Height); 
   Rectangle dstClipRect = new Rectangle(0, 0, 0, 0); 
 
   rasterDocument.DrawPage(graph, 0, srcRect, srcClipRect, dstRect, dstClipRect, RasterPaintProperties.Default); 
   rasterDocument.SelectZone(graph, 0, 0, true); 
   rasterDocument.Shutdown(); 
}

Remarks

Before calling this method, you must specify the active page to be drawn using the ActivePage property. If the ActivePage property is not set, then this method will fail.
For more information, refer to Drawing Pages and Zones.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Documentrequires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features