Error processing SSI file
LEADTOOLS Leadtools.Documents (Leadtools.Documents assembly)

Show in webframe

RasterCodecsTemplate Property






Global template used when loading and saving raster and SVG images.
Syntax
public static RasterCodecs RasterCodecsTemplate {get; set;}
'Declaration
 
Public Shared Property RasterCodecsTemplate As RasterCodecs
'Usage
 
Dim value As RasterCodecs
 
DocumentFactory.RasterCodecsTemplate = value
 
value = DocumentFactory.RasterCodecsTemplate
public static RasterCodecs getRasterCodecsTemplate()
public void sasterCodecs getRasterCodecsTemplate(static value)
            
public:
static property RasterCodecs^ RasterCodecsTemplate {
   RasterCodecs^ get();
   void set (    RasterCodecs^ value);
}

Property Value

The global RasterCodecs template to use when loading and saving raster and SVG images. Default is a RasterCodecs object with the value of CodecsRasterizeDocumentLoadOptions.Resolution set to 300.
Remarks

The RasterCodecs class is used throughout the Documents library to load and save RasterImage and SvgDocument objects. This class contain various options to control how the data is loaded and processed. For example, setting the resolution (DPI) to use when rasterizing a text-based PDF file.

When a new Document object is created by this factory, a new RasterCodecs object is created and set in Document.RasterCodecs, RasterCodecsTemplate is then checked and if it is not null, then the options are copied from and set to Document.RasterCodecs using CodecsOptions.Clone. This way, the library guarantees that the same global options set by the user in RasterCodecsTemplate are used throughout the application.

The Documents library is thread safe while a single RasterCodecs object is not and cannot be used by multiple threads at the same time, therefore, the library will internally create instances of RasterCodecs and disposes them as needed (for example, when calling DocumentPage.GetImage to get the raster image representation of a page.

Whenever this happens, the library will copy the options from Document.RasterCodecs into the options of the temporarily created RasterCodecs object using CodecsOptions.Clone. This way, the library guarantees that the same global options set by the user in RasterCodecsTemplate are used throughout the application if needed while the options can be changed for each Document individually.

Example

This examples shows how to use RasterCodecsTemplate to change the resolution used when loading document files.

Copy Code  
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

<TestMethod()> _
Public Sub DocumentFactoryRasterCodecsTemplateExample()
   Dim options As New LoadDocumentOptions()
   options.UseCache = False
   DocumentFactory.RasterCodecsTemplate.Options.RasterizeDocument.Load.XResolution = 100
   DocumentFactory.RasterCodecsTemplate.Options.RasterizeDocument.Load.YResolution = 100

   Using document As Leadtools.Documents.Document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options)
      For Each page As Leadtools.Documents.DocumentPage In document.Pages
         Console.WriteLine("Page (" & page.PageNumber & ") - Resolution: " & page.Resolution)
      Next page
   End Using
End Sub
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;
using Leadtools.Documents;
using Leadtools.Caching;
using Leadtools.Annotations.Core;
using Leadtools.Forms.Ocr;
using Leadtools.Barcode;

[TestMethod]
public void DocumentFactoryRasterCodecsTemplateExample()
{
   var options = new LoadDocumentOptions();
   options.UseCache = false;
   DocumentFactory.RasterCodecsTemplate.Options.RasterizeDocument.Load.XResolution = 100;
   DocumentFactory.RasterCodecsTemplate.Options.RasterizeDocument.Load.YResolution = 100;

   using (var document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options))
   {
      foreach (var page in document.Pages)
      {
         Console.WriteLine("Page (" + page.PageNumber + ") - Resolution: " + page.Resolution);
      }
   }
}
Requirements

Target Platforms

See Also

Reference

DocumentFactory Class
DocumentFactory Members

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