LEADTOOLS Forms (Leadtools.Forms.DocumentReaders assembly)

DocumentImageManager Class

Show in webframe
Example 





Members 
Contains the image functionality associated with a DocumentReader.
Object Model
Syntax
public class DocumentImageManager 
'Declaration
 
Public Class DocumentImageManager 
'Usage
 
Dim instance As DocumentImageManager

            

            
public ref class DocumentImageManager 
Remarks

An instance of the DocumentImageManager isn't created directly, instead access the instance automatically created inside a DocumentReader using the DocumentReader.ImageManager property.

The DocumentImageManager contains the following functionality:

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms
Imports Leadtools.Forms.DocumentReaders
Imports Leadtools.WinForms
Imports Leadtools.Forms.Ocr
Imports Leadtools.Drawing

Public Sub DocumentImageManagerExample()
   ' Get a document from the user
   Dim documentFileName As String

   Using openDlg As New OpenFileDialog()
      If openDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then
         Return
      End If

      documentFileName = openDlg.FileName
   End Using

   ' Load the document at 300 DPI for high quality rendering
   Dim loadOptions As New DocumentReaderLoadOptions()
   loadOptions.Resolution = 300
   Using reader As DocumentReader = DocumentReader.Create(documentFileName, loadOptions)
      ' Ask the user for the output TIFF file name
      Dim tiffFileName As String

      Using saveDlg As New SaveFileDialog()
         saveDlg.Filter = "TIFF files|*.tif;*.tiff|All Files|*.*"
         If saveDlg.ShowDialog() <> System.Windows.Forms.DialogResult.OK Then
            Return
         End If

         tiffFileName = saveDlg.FileName

         If File.Exists(tiffFileName) Then
            ' Because we will append pages, delete the file if it already exists
            File.Delete(tiffFileName)
         End If
      End Using

      ' Loop through all the pages and get a render of each
      For Each page As DocumentReaderPage In reader.Pages
         Using pageImage As RasterImage = reader.ImageManager.GetPageImage(page)
            ' Save it to the output file, we can use the RasterCodecs object
            ' of the reader
            reader.RasterCodecsInstance.Save(pageImage, tiffFileName, RasterImageFormat.TifJpeg, _
                                             24, 1, 1, -1, CodecsSavePageMode.Append)
         End Using
      Next
   End Using
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms;
using Leadtools.Forms.DocumentReaders;
using Leadtools.WinForms;
using Leadtools.Forms.Ocr;
using Leadtools.Drawing;

public void DocumentImageManagerExample()
{
   // Get a document from the user
   string documentFileName;

   using(OpenFileDialog openDlg = new OpenFileDialog())
   {
      if(openDlg.ShowDialog() != DialogResult.OK)
      {
         return;
      }

      documentFileName = openDlg.FileName;
   }

   // Load the document at 300 DPI for high quality rendering
   DocumentReaderLoadOptions loadOptions = new DocumentReaderLoadOptions();
   loadOptions.Resolution = 300;
   using(DocumentReader reader = DocumentReader.Create(documentFileName, loadOptions))
   {
      // Ask the user for the output TIFF file name
      string tiffFileName;

      using(SaveFileDialog saveDlg = new SaveFileDialog())
      {
         saveDlg.Filter = "TIFF files|*.tif;*.tiff|All Files|*.*";
         if(saveDlg.ShowDialog() != DialogResult.OK)
         {
            return;
         }

         tiffFileName = saveDlg.FileName;

         if(File.Exists(tiffFileName))
         {
            // Because we will append pages, delete the file if it already exists
            File.Delete(tiffFileName);
         }
      }

      // Loop through all the pages and get a render of each
      foreach(DocumentReaderPage page in reader.Pages)
      {
         using(RasterImage pageImage = reader.ImageManager.GetPageImage(page))
         {
            // Save it to the output file, we can use the RasterCodecs object
            // of the reader
            reader.RasterCodecsInstance.Save(pageImage, tiffFileName, RasterImageFormat.TifJpeg, 24, 1, 1, -1, CodecsSavePageMode.Append);
         }
      }
   }
}
Requirements

Target Platforms

See Also

Reference

DocumentImageManager Members
Leadtools.Forms.DocumentReaders Namespace

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Forms.DocumentWriters requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features