public final class

ImageDocumentLoader

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.ImageDocumentLoader

Class Overview

Helper class for loading ImageDocument from a DocumentSource.

Summary

Public Constructors
ImageDocumentLoader()
Public Methods
static PdfActivityConfiguration getDefaultImageDocumentActivityConfiguration(PdfActivityConfiguration configuration)
Returns default activity configuration for image documents from a given initial configuration.
static PdfActivityConfiguration getDefaultImageDocumentActivityConfiguration(Context context)
Returns default activity configuration for image documents.
static PdfConfiguration getDefaultImageDocumentConfiguration(PdfConfiguration configuration)
Returns default configuration for image documents from a given initial configuration.
static PdfConfiguration getDefaultImageDocumentConfiguration()
Returns default configuration for image documents.
static ImageDocument openDocument(Context context, Uri documentUri)

Opens an image document from a Uri.

static ImageDocument openDocument(Context context, DocumentSource source)

Opens an image document from a Uri.

static Single<ImageDocument> openDocumentAsync(Context context, DocumentSource source)
Opens an image document from a Uri.
static Single<ImageDocument> openDocumentAsync(Context context, Uri documentUri)
Opens an image document from a Uri.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ImageDocumentLoader ()

Public Methods

public static PdfActivityConfiguration getDefaultImageDocumentActivityConfiguration (PdfActivityConfiguration configuration)

Returns default activity configuration for image documents from a given initial configuration. For a better user experience, thumbnail bar and page number overlay will be hidden, layout mode will be set to SINGLE and fit mode will be set to FIT_TO_SCREEN.

Parameters
configuration Given configuration which will be tailored with better options specific for image documents.
Returns
  • Default activity configuration specifically thought for image documents (e.g. for a better user experience thumbnail bar and page number overlay are hidden).

public static PdfActivityConfiguration getDefaultImageDocumentActivityConfiguration (Context context)

Returns default activity configuration for image documents.

Returns
  • Default activity configuration specifically thought for image documents (e.g. for a better user experience thumbnail bar and page number overlay are hidden).

public static PdfConfiguration getDefaultImageDocumentConfiguration (PdfConfiguration configuration)

Returns default configuration for image documents from a given initial configuration. For a better user experience, layout mode will be set to SINGLE and fit mode will be set to FIT_TO_SCREEN.

Parameters
configuration Given configuration which will be tailored with better options specific for image documents.
Returns
  • Default configuration specifically thought for image documents (e.g. for a better user experience layout mode is set to single and fit mode is set to the screen dimension).

public static PdfConfiguration getDefaultImageDocumentConfiguration ()

Returns default configuration for image documents.

Returns
  • Default configuration specifically thought for image documents (e.g. for a better user experience layout mode is set to single and fit mode is set to the screen dimension).

public static ImageDocument openDocument (Context context, Uri documentUri)

Opens an image document from a Uri. Note that currently only local files are supported and passing remote or non-file Uris will throw an IOException.


Note that this method blocks until the image document is loaded and should not be invoked on main thread.

Parameters
context Application context.
documentUri Uri pointing to the PDF document.
Returns
Throws
IOException If file was not opened correctly.
PSPDFKitNotInitializedException If PSPDFKit was not initialized with initialize(Context, String) call.

public static ImageDocument openDocument (Context context, DocumentSource source)

Opens an image document from a Uri. Note that currently only local files are supported and passing remote or non-file Uris will throw an IOException.


Note that this method blocks until the image document is loaded and should not be invoked on main thread.

Parameters
context Application context.
source DocumentSource describing the source of the image document.
Returns
Throws
IOException If file was not opened correctly.
PSPDFKitNotInitializedException If PSPDFKit was not initialized with initialize(Context, String) call.

public static Single<ImageDocument> openDocumentAsync (Context context, DocumentSource source)

Opens an image document from a Uri. Note that currently only local files are supported and passing remote or non-file Uris will throw an IOException.

Parameters
context Application context.
source DocumentSource describing the source of the image document.
Returns
  • Single observable returning an ImageDocument instance if the opening succeeded.
Throws
PSPDFKitNotInitializedException If PSPDFKit was not initialized with initialize(Context, String) call.

public static Single<ImageDocument> openDocumentAsync (Context context, Uri documentUri)

Opens an image document from a Uri. Note that currently only local files are supported and passing remote or non-file Uris will throw an IOException.

Parameters
context Application context.
documentUri Uri pointing to the PDF document.
Returns
  • Single observable returning an ImageDocument instance if the opening succeeded.
Throws
PSPDFKitNotInitializedException If PSPDFKit was not initialized with initialize(Context, String) call.