←Select platform

GetAnnotations Method (DocumentPage)

Summary

Gets the annotations container of this page.

Syntax

C#
VB
Java
C++
public AnnContainer GetAnnotations( 
   bool createEmpty 
) 
Public Function GetAnnotations( 
   ByVal createEmpty As Boolean 
) As AnnContainer 
public:  
   AnnContainer^ GetAnnotations( 
      bool createEmpty 
   ) 
public AnnContainer getAnnotations(boolean createEmpty)

Parameters

createEmpty

true to create and return an empty LEADTOOLS annotations container if the page does not have one originally, otherwise;

false to return null if the page does not have an original container.

Return Value

The annotation container for this page if available, or null.

Remarks

GetAnnotations is used to get the annotations container of this page. All document types support this method.

SetAnnotations is used to replace the annotation container of the page. IsAnnotationsModified is used to as flag that indicates that the annotations container of this page has been replaced by the user.

This method works as follows (the "item" is an annotation container):

  1. If an item was found in the cache, it is returned right away. This is available if the document was created using the cache system. and Document.CacheOptions contains DocumentCacheOptions.PageAnnotations. AnnCodecs is used to load the AnnContainer object from the data found in the cache.

  2. If this is an original page in the source document file (the value of OriginalPageNumber is not -1), then the annotation is container is loaded from the original document. See below for more information.

  3. If this is not an original page in the source document file (the value of OriginalPageNumber is not 1), then depending on the value of createEmpty a new AnnContainer object is created based on the page size and resolution or null is used.

  4. If this document uses the cache system (Document.HasCache is true), then the AnnContainer object is saved to the cache before it is returned. Next time this method is called, the container will be returned from the cache directly without loading it from the file or creating a new instance.

Note that if SetAnnotations has been previously called with a null object for the container parameter, then this method will return null as well.

In all cases, the returned AnnContainer object is not used by this Document, the user is responsible for deleting it after it has been used.

The original annotation of the document is obtained in one of two ways:

  • If the user passed the location of an external LEADTOOLS annotations file to use with the document using LoadDocumentOptions.AnnotationsUri, then this file is checked against OriginalPageNumber and if an item is found, it is loaded and used by this method.

  • If this document type supports embedded annotations (such as PDF or TIFF documents) and the user set the value of LoadDocumentOptions.LoadEmbeddedAnnotations to true, then this method will try to load the annotations from the document file itself if found. The value of HasEmbeddedAnnotations will be true if the original document file contain an annotation container for this page.

In either case, if the original document or annotation file did not have an annotation container for this page, the createEmpty will be used to either return null or create an empty container for the page. Note that you can use DocumentAnnotations.GetAnnotations and DocumentAnnotations.SetAnnotations to get or set an array of annotations container objects for one or more pages with a single call. The LEADTOOLS Document Viewer uses this method to obtain the annotation container for the page when. The LEADTOOLS Document Converter uses this method to obtain annotation container for the page when annotations options are used during convertions. Refer to Loading Using LEADTOOLS Documents Library for more information.

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Documents Assembly
Click or drag to resize