←Select platform

LoadFromFile Method

Summary

Loads a document from existing data stored in a disk file.

Syntax

C#
VB
Java
C++
public static Document LoadFromFile( 
   string fileName, 
   LoadDocumentOptions options 
) 
Public Shared Function LoadFromFile( 
   ByVal fileName As String, 
   ByVal options As LoadDocumentOptions 
) As Document 
public:  
   static Document^ LoadFromFile( 
      String^ fileName, 
      LoadDocumentOptions^ options 
   ) 
public static Document loadFromFile(String fileName, LoadDocumentOptions options) 

Parameters

fileName

Path to the file name containing the original document data. This value cannot be null.

options

Options to use when loading the document. This value cannot be null.

Return Value

The newly created document object.

Remarks

This method may use the cache if the related cache options are set. If the cache is used and neither the LoadDocumentOptions.Cache property nor the Cache property was set up with a valid cache object, this method will throw an exception.

LoadFromFile, LoadFromUri, LoadFromUriAsync and LoadFromStream creates a Document class from any supported image or document file format stored in a disk file, a remote URL, or a stream. The returned object can then be used to retrieve any page as an image or an SVG, obtain the text using SVG or OCR, or use the annotations or the document structure such as links and bookmarks.

After the document is obtained, the InternalObject property will be set to the internal LEADTOOLS object used with the document.

Refer to Load Using LEADTOOLS Documents Library for detailed information on how to use this method and the various options.

Example

C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.DocumentWriters; 
using Leadtools.Svg; 
using LeadtoolsExamples.Common; 
using Leadtools.Documents; 
using Leadtools.Caching; 
using Leadtools.Annotations.Core; 
using Leadtools.Forms.Ocr; 
using Leadtools.Barcode; 
 
public static void DocumentFactoryLoadFromFileExample() 
{ 
   var options = new LoadDocumentOptions(); 
   using (var document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options)) 
   { 
      PrintOutDocumentInfo(document); 
   } 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Forms.DocumentWriters 
Imports Leadtools.Svg 
Imports Leadtools.Documents 
Imports Leadtools.Caching 
Imports Leadtools.Annotations.Core 
Imports Leadtools.Barcode 
Imports Leadtools.Forms.Ocr 
Imports LeadtoolsDocumentsExamples.LeadtoolsExamples.Common 
'Imports LeadtoolsDocumentsExamples.LeadtoolsExamples.Common 
 
Public Shared Sub DocumentFactoryLoadFromFileExample() 
   Dim options As New LoadDocumentOptions() 
   Using document As Leadtools.Documents.Document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options) 
      PrintOutDocumentInfo(document) 
   End Using 
End Sub 

Requirements

Target Platforms

Help Version 19.0.2017.10.18
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Documents Assembly