Interface IDataProvider

This interface is to be used by all possible data providers for PDF access.

Namespace: PSPDFKitFoundation.Data
Assembly: PSPDFKitFoundation.dll
Syntax
public interface IDataProvider

Properties

Size

Returns the size of the data.

Declaration
ulong Size { get; }
Property Value
Type Description
System.UInt64

SupportsWriting

Specifies whether a write can be attempted using ReplaceWithDataSinkAsync(IDataSink).

Declaration
bool SupportsWriting { get; }
Property Value
Type Description
System.Boolean

Uid

Returns a UID that enables you to uniquely identify this data provider, even after re-starting the application.

Declaration
string Uid { get; }
Property Value
Type Description
System.String

Methods

CreateDataSink(DataSinkOption)

This method creates a data sink for your data provider with the given DataSinkOption. PSPDFKit will write all the appropriate data into it and pass it to ReplaceWithDataSinkAsync(IDataSink) when appropriate.

Declaration
IDataSink CreateDataSink(DataSinkOption option)
Parameters
Type Name Description
DataSinkOption option
Returns
Type Description
IDataSink

ReadAsync(UInt32, UInt32)

Reads and returns data read from offset with size. You have to make sure not to read past the end of your data.

Declaration
IAsyncOperation<IBuffer> ReadAsync(uint size, uint offset)
Parameters
Type Name Description
System.UInt32 size

The requested amount of data to read.

System.UInt32 offset

The offset into the data source to start reading from.

Returns
Type Description
Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IBuffer>

ReplaceWithDataSinkAsync(IDataSink)

This method should replace your current data with the one written into data sink. is the object instantiated with CreateDataSink(DataSinkOption). Depending on the DataSinkOption used you either have to append or replace the data.

Declaration
IAsyncOperation<bool> ReplaceWithDataSinkAsync(IDataSink dataSink)
Parameters
Type Name Description
IDataSink dataSink
Returns
Type Description
Windows.Foundation.IAsyncOperation<System.Boolean>