Error processing SSI file
LEADTOOLS PDF (Leadtools.Pdf assembly)

Show in webframe

DrawDocument Method






The HDC where the PDF file should be rendered.
The resolution at which to render the PDF file.
The page number to be rendered.
Renders the specified page of the PDF file.
Syntax
public void DrawDocument( 
   IntPtr hdc,
   int resolution,
   int pageNumber
)
'Declaration
 
Public Sub DrawDocument( _
   ByVal hdc As IntPtr, _
   ByVal resolution As Integer, _
   ByVal pageNumber As Integer _
) 
'Usage
 
Dim instance As PDFFile
Dim hdc As IntPtr
Dim resolution As Integer
Dim pageNumber As Integer
 
instance.DrawDocument(hdc, resolution, pageNumber)
public:
void DrawDocument( 
   IntPtr hdc,
   int resolution,
   int pageNumber
) 

Parameters

hdc
The HDC where the PDF file should be rendered.
resolution
The resolution at which to render the PDF file.
pageNumber
The page number to be rendered.
Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Pdf
Imports Leadtools.WinForms
Imports Leadtools.Svg
Imports Leadtools.ImageProcessing

<TestMethod> _
Public Sub PDFFileDrawDocumentExample()
   Dim sourceFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf")
   Dim destinationFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "LEAD_DrawDocument.tif")
   Dim pdfFile As PDFFile = New PDFFile(sourceFileName)

   ' Create an image
   Using image As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 2550, 3300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)
      ' Make the image white
      Dim fillCmd As FillCommand = New FillCommand(RasterColor.White)
      fillCmd.Run(image)

      ' Get a handle to the drawing surface
      Dim hDC As IntPtr = RasterImagePainter.CreateLeadDC(image)

      ' Render the image data
      pdfFile.DrawDocument(hDC, 300, 1)

      ' Save the image in another format
      Using codecs As RasterCodecs = New RasterCodecs()
         codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel)
      End Using

      ' Clean up
      RasterImagePainter.DeleteLeadDC(hDC)
   End Using
End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Controls;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.Pdf;
using Leadtools.Svg;
using Leadtools.WinForms;

[TestMethod]
public void PDFFileDrawDocumentExample()
{
   string sourceFileName = Path.Combine(LEAD_VARS.ImagesDir, @"Leadtools.pdf");
   string destinationFileName = Path.Combine(LEAD_VARS.ImagesDir, @"LEAD_DrawDocument.tif");
   PDFFile pdfFile = new PDFFile(sourceFileName);

   // Create an image
   using (RasterImage image = new RasterImage(RasterMemoryFlags.Conventional, 2550, 3300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, null, 0))
   {
      // Make the image white
      FillCommand fillCmd = new FillCommand(RasterColor.White);
      fillCmd.Run(image);

      // Get a handle to the drawing surface
      IntPtr hDC = RasterImagePainter.CreateLeadDC(image);

      // Render the image data
      pdfFile.DrawDocument(hDC, 300, 1);

      // Save the image in another format
      using (RasterCodecs codecs = new RasterCodecs())
         codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel);

      // Clean up
      RasterImagePainter.DeleteLeadDC(hDC);
   }
}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
Requirements

Target Platforms

See Also

Reference

PDFFile Class
PDFFile Members

Error processing SSI file
   Leadtools.Pdf requires a PDF Pro, Pro Suite, Document, or Medical license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features