Click or drag to resize

DocumentPreviewCache Class

DocumentPreviewCache is a persistent cache that provides thumbnails for browsing in PDFNet. The cache is placed in the sub - directory 'trn_DocumentPreviewCache' of the PDFNet Resources folder, which can be set by calling PDFNet::SetPersistentCachePath.In the case the PersistentCachePath is not set the files will be stored in the system temp path (PDFNet::GetSystemTempPath()).The cache will be used by any PDFNet process that uses the resource path.If more than one PDFNet process is running concurrently, the first process to acquire a lock on the cache will use it.Subsequent processes will not read or modify the cache. DocumentPreviewCache will store references to generated JPG thumbnails and keeps track of the dimensions of the thumbnail and the filesize of the specific pdf documents. Furthermore it takes care that the size constraints(max_cache_bytes, max_disk_percentage) are met and it cleans the oldest(in terms of last request) thumbs from the cache in case of a overflow. If the user requests a file that is already in the cache and the requested thumb dimensions are smaller or equal than the ones of the cache - version the URL of the cached thumb is given back.If the dimensions are bigger the thumb gets rendered again, the old thumb gets replaced and the URL is given back. If the size of the pdf document changes the thumb will be rendered again even when there is a version of that thumbnail in the cache.In case that the user wants to suppress the re-rendering of that specific thumb(e.g.when the change on the pdf document was made on another page than the first page which is used for the thumb), IrrelevantChangeMade has to be called.
Remarks
Note: Always call the DocumentPreviewCache from the UI thread.
Inheritance Hierarchy
SystemObject
  DependencyObject
    pdftron.PDFDocumentPreviewCache

Namespace:  pdftron.PDF
Assembly:  pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax
public sealed class DocumentPreviewCache : DependencyObject

The DocumentPreviewCache type exposes the following members.

Constructors
  NameDescription
Public methodDocumentPreviewCache
Initializes a new instance of the DocumentPreviewCache class
Top
Properties
  NameDescription
Public propertyDispatcher (Inherited from DependencyObject.)
Top
Methods
  NameDescription
Public methodStatic memberCancelAllRequests
CancelAllRequests cancels all pending requests. The PreviewHandler of each pending request will signal that the preview could not be found.
Public methodStatic memberCancelRequest
CancelRequest cancels all pending thumbnail requests associated with 'filepath_or_uuid'. If the cancel request is processed earlier than the path of the thumbnail could be retrieved the respective request will be cancelled and the PreviewHandler will signal that the thumb could not be found.
Public methodStatic memberClearCache
Remove the cache from the disk completely, deleting any thumbnails. You may want to do this if you detect some kind of corruption, or if the user wants to clear out disk space used by your application.
Public methodClearValue (Inherited from DependencyObject.)
Public methodStatic memberCreateBitmapWithID(String, PDFDoc, Int32, Int32, Object)
createBitmapWithID gets the path to the thumbnail in the DocumentPreviewCache associated with the document with 'uuid'. This method should be used together with getBitmapWithID. The decision if the thumb should be re-rendered is based on two factors. First if the current version fulfills the minimal dimensions 'min_x_size' x 'min_y_size' and second if the size of the pdf document hasn't changed. To signal an edit of the pdf document without a resulting re-rendering of the thumb see IrrelevantChangeMade.
Public methodStatic memberCreateBitmapWithID(String, StorageFile, Int32, Int32, Object)
createBitmapWithID gets the path to the thumbnail in the DocumentPreviewCache associated with the document with 'uuid'. This method should be used together with getBitmapWithID. The decision if the thumb should be re-rendered is based on two factors. First if the current version fulfills the minimal dimensions 'min_x_size' x 'min_y_size' and second if the size of the pdf document hasn't changed. To signal an edit of the pdf document without a resulting re-rendering of the thumb see IrrelevantChangeMade.
Public methodStatic memberCreateBitmapWithID(String, IRandomAccessStream, Int32, Int32, Object)
createBitmapWithID gets the path to the thumbnail in the DocumentPreviewCache associated with the document with 'uuid'. This method should be used together with getBitmapWithID. The decision if the thumb should be re-rendered is based on two factors. First if the current version fulfills the minimal dimensions 'min_x_size' x 'min_y_size' and second if the size of the pdf document hasn't changed. To signal an edit of the pdf document without a resulting re-rendering of the thumb see IrrelevantChangeMade.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetAnimationBaseValue (Inherited from DependencyObject.)
Public methodStatic memberGetBitmapWithID
getBitmapWithID gets the path to the thumbnail in the DocumentPreviewCache associated with the document with 'uuid'. This method should be used together with createBitmapWithID. The decision if the thumb should be re-rendered is based on two factors. First if the current version fulfills the minimal dimensions 'min_x_size' x 'min_y_size' and second if the size of the pdf document hasn't changed. To signal an edit of the pdf document without a resulting re-rendering of the thumb see IrrelevantChangeMade.
Public methodStatic memberGetBitmapWithPath
getBitmapWithPath gets the path to the thumbnail in the DocumentPreviewCache associated with the document at 'filepath'. The decision if the thumb should be re-rendered is based on two factors. First if the current version fulfills the minimal dimensions 'min_x_size' x 'min_y_size' and second if the size of the pdf document hasn't changed. To signal an edit of the pdf document without a resulting re-rendering of the thumb see IrrelevantChangeMade.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetValue (Inherited from DependencyObject.)
Public methodStatic memberInitialize
Initialize the preview cache. If the cache already exists, it will shrink to conform to these limits immediately.
Public methodStatic memberIrrelevantChangeMade
IrrelevantChangeMade should be called if the size of the pdf file at 'filepath' was changed but the thumbnail should not be re-generated. This should be done when no editing was done on the first page of the document.
Public methodReadLocalValue (Inherited from DependencyObject.)
Public methodRegisterPropertyChangedCallback (Inherited from DependencyObject.)
Public methodSetValue (Inherited from DependencyObject.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUnregisterPropertyChangedCallback (Inherited from DependencyObject.)
Top
Events
  NameDescription
Public eventStatic memberDocumentPreviewCacheResponse
Event used to get responses from the DocumentPreviewCache
Top
See Also