C#
VB
C++
Renders the specified page of the PDF file.
public void DrawDocument(IntPtr hdc,int resolution,int pageNumber)
Public Sub DrawDocument( _ByVal hdc As IntPtr, _ByVal resolution As Integer, _ByVal pageNumber As Integer _)
public:void DrawDocument(IntPtr hdc,int resolution,int pageNumber)
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.
using Leadtools;using Leadtools.Codecs;using Leadtools.Controls;using Leadtools.Drawing;using Leadtools.ImageProcessing;using Leadtools.Pdf;using Leadtools.Svg;using Leadtools.WinForms;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 imageusing (RasterImage image = new RasterImage(RasterMemoryFlags.Conventional, 2550, 3300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, null, 0)){// Make the image whiteFillCommand fillCmd = new FillCommand(RasterColor.White);fillCmd.Run(image);// Get a handle to the drawing surfaceIntPtr hDC = RasterImagePainter.CreateLeadDC(image);// Render the image datapdfFile.DrawDocument(hDC, 300, 1);// Save the image in another formatusing (RasterCodecs codecs = new RasterCodecs())codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel);// Clean upRasterImagePainter.DeleteLeadDC(hDC);}}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.PdfImports Leadtools.WinFormsImports Leadtools.SvgImports Leadtools.ImageProcessingPublic 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 imageUsing image As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 2550, 3300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0)' Make the image whiteDim fillCmd As FillCommand = New FillCommand(RasterColor.White)fillCmd.Run(image)' Get a handle to the drawing surfaceDim hDC As IntPtr = RasterImagePainter.CreateLeadDC(image)' Render the image datapdfFile.DrawDocument(hDC, 300, 1)' Save the image in another formatUsing codecs As RasterCodecs = New RasterCodecs()codecs.Save(image, destinationFileName, RasterImageFormat.TifLzw, image.BitsPerPixel)End Using' Clean upRasterImagePainter.DeleteLeadDC(hDC)End UsingEnd SubPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
