Class
InMemoryFixedDocumentRepository

Repository for multi-document orchestration scenarios. Manages multiple PDF documents in memory with support for creation and import.

Definition

Namespace:Telerik.Documents.AI.Tools.Fixed.Core

Assembly:Telerik.Documents.AI.Tools.Fixed.Core.dll

Syntax:

cs-api-definition
public sealed class InMemoryFixedDocumentRepository : InMemoryDocumentRepositoryBase<RadFixedDocument>, IFixedDocumentRepository, IDocumentRepository<RadFixedDocument>, IDocumentRepository

Inheritance: objectInMemoryDocumentRepositoryBase<RadFixedDocument>InMemoryFixedDocumentRepository

Implements: IDocumentRepositoryIDocumentRepository<RadFixedDocument>IFixedDocumentRepository

Inherited Members InMemoryDocumentRepositoryBase<RadFixedDocument>.GetDocument(string)InMemoryDocumentRepositoryBase<RadFixedDocument>.GetDocumentAsObject(string)InMemoryDocumentRepositoryBase<RadFixedDocument>.ListDocuments()InMemoryDocumentRepositoryBase<RadFixedDocument>.RemoveDocument(string)InMemoryDocumentRepositoryBase<RadFixedDocument>.Clear()InMemoryDocumentRepositoryBase<RadFixedDocument>.SupportsCreationInMemoryDocumentRepositoryBase<RadFixedDocument>.SupportsMultipleDocuments

Constructors

InMemoryFixedDocumentRepository(TimeSpan?)

Initializes a new instance with no documents.

Declaration

cs-api-definition
public InMemoryFixedDocumentRepository(TimeSpan? importTimeout)

Parameters

importTimeout

TimeSpan?

Timeout for import operations, or null to allow unlimited time.

Properties

DefaultFormat

Gets the default format for documents created by this repository.

Declaration

cs-api-definition
protected override DocumentFormat DefaultFormat { get; }

Property Value

DocumentFormat

Overrides InMemoryDocumentRepositoryBase<RadFixedDocument>.DefaultFormat

DefaultNewDocumentBaseName

Gets the default base name for newly created documents.

Declaration

cs-api-definition
protected override string DefaultNewDocumentBaseName { get; }

Property Value

string

Overrides InMemoryDocumentRepositoryBase<RadFixedDocument>.DefaultNewDocumentBaseName

DocumentType

Gets the document type managed by this repository.

Declaration

cs-api-definition
public override DocumentType DocumentType { get; }

Property Value

DocumentType

Overrides InMemoryDocumentRepositoryBase<RadFixedDocument>.DocumentType

Implements IDocumentRepository.DocumentType

Methods

AddDocument(string, RadFixedDocument)

Adds an existing document to the repository.

Declaration

cs-api-definition
public void AddDocument(string documentId, RadFixedDocument document)

Parameters

documentId

string

The identifier for the document.

document

RadFixedDocument

The document to add.

CreateDocument(string, string[])

Creates a document using the specified document identifier and arguments.

Declaration

cs-api-definition
public string CreateDocument(string documentId, string[] args)

Parameters

documentId

string

The unique identifier for the document to be created. Cannot be null or empty.

args

string[]

An array of arguments used to populate or configure the document. Cannot be null.

Returns

string

A string containing the contents of the created document.

Implements IDocumentRepository.CreateDocument(string, string[])

Export(string, DocumentFormat, Stream)

Exports a document to a byte array in the specified format.

Declaration

cs-api-definition
public void Export(string documentId, DocumentFormat format, Stream destinationStream)

Parameters

documentId

string

The document identifier to export. If null, exports the default/current document.

format

DocumentFormat

The target format for export.

destinationStream

Stream

The stream to which the document will be exported.

Exceptions

NotSupportedException

Thrown when the specified format is not supported.

KeyNotFoundException

Thrown when the specified document ID does not exist.

Implements IDocumentRepository.Export(string, DocumentFormat, Stream)

Import(Stream, DocumentFormat, string)

Imports a document from a byte array and adds it to the repository.

Declaration

cs-api-definition
public string Import(Stream data, DocumentFormat format, string documentName = null)

Parameters

data

Stream

The document content as a byte array.

format

DocumentFormat

The format of the document being imported.

documentName

string

Optional name for the imported document.

Returns

string

The document ID assigned to the imported document.

Exceptions

NotSupportedException

Thrown when the repository does not support creation or the format is not supported.

Implements IDocumentRepository.Import(Stream, DocumentFormat, string)

MergeAndExport(string[], Stream, DocumentFormat)

Merges the specified source documents and exports the combined result to the provided stream in the specified format.

Declaration

cs-api-definition
public void MergeAndExport(string[] sourceFileIds, Stream stream, DocumentFormat exportFormat)

Parameters

sourceFileIds

string[]

An array of identifiers for the source documents to merge. The order of identifiers determines the order in which documents are merged. Cannot be null or empty.

stream

Stream

The stream to which the merged document will be written. Must be writable and remain open for the duration of the operation.

exportFormat

DocumentFormat

The format in which to export the merged document.

Implements IDocumentRepository.MergeAndExport(string[], Stream, DocumentFormat)