public class

PdfDocumentCheckpointer

extends Object
implements AnnotationProvider.OnAnnotationUpdatedListener
java.lang.Object
   ↳ com.pspdfkit.document.checkpoint.PdfDocumentCheckpointer

Class Overview

Handles documents checkpoint, cleaning and saving strategy.

Summary

Public Constructors
PdfDocumentCheckpointer(InternalPdfDocument document, File checkpointFile, CheckpointerConfiguration configuration)
Public Methods
boolean checkpointExists()
Checks if a checkpoint for the document exists.
void deleteAllCheckpoints()
Deletes all checkpoints stored on-disk.
boolean deleteCheckpoint()
Deletes the checkpoint if exists.
Single<Boolean> deleteCheckpointAsync()
Asynchronously deletes the checkpoint.
PdfDocumentCheckpointingStrategy getStrategy()
Returns the strategy used for saving the checkpoint.
static boolean isCheckpointSupported(DocumentSource documentSource)
Returns true if the checkpoint is supported.
boolean isDirty()
Returns true if the document has been modified since the last saving.
void onAnnotationCreated(Annotation annotation)
Called when annotation has been created.
void onAnnotationRemoved(Annotation annotation)
Called when existing annotation has been removed.
void onAnnotationUpdated(Annotation annotation)
Called when existing annotation has changed.
boolean saveCheckpoint()
Saves the checkpoint persistently on the local storage.
Single<Boolean> saveCheckpointAsync()
Saves the checkpoint asynchronously.
void setStrategy(PdfDocumentCheckpointingStrategy strategy)
Sets the strategy to use for saving the checkpoint.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pspdfkit.annotations.AnnotationProvider.OnAnnotationUpdatedListener

Public Constructors

public PdfDocumentCheckpointer (InternalPdfDocument document, File checkpointFile, CheckpointerConfiguration configuration)

Public Methods

public boolean checkpointExists ()

Checks if a checkpoint for the document exists.

Returns
  • true if a checkpoint exists, false otherwise.

public void deleteAllCheckpoints ()

Deletes all checkpoints stored on-disk.

public boolean deleteCheckpoint ()

Deletes the checkpoint if exists.

Returns
  • true if the checkpoint was deleted, false otherwise.

public Single<Boolean> deleteCheckpointAsync ()

Asynchronously deletes the checkpoint.

Scheduler:
deleteCheckpointAsync does not operate by default on a particular Scheduler.

Returns
  • Single returning true if the checkpoint was deleted, false otherwise.

public PdfDocumentCheckpointingStrategy getStrategy ()

Returns the strategy used for saving the checkpoint. See PdfDocumentCheckpointingStrategy for exact behaviour. Note that MANUAL is the strategy used by default.

Returns
  • The strategy used for saving the checkpoint.

public static boolean isCheckpointSupported (DocumentSource documentSource)

Returns true if the checkpoint is supported. Checkpointing is only supported for unencrypted single-source documents.

Parameters
documentSource Document source to check.
Returns
  • true if checkpoint is supported, false otherwise.

public boolean isDirty ()

Returns true if the document has been modified since the last saving.

Returns
  • true if the document has been modified, false otherwise.

public void onAnnotationCreated (Annotation annotation)

Called when annotation has been created.

public void onAnnotationRemoved (Annotation annotation)

Called when existing annotation has been removed.

public void onAnnotationUpdated (Annotation annotation)

Called when existing annotation has changed.

public boolean saveCheckpoint ()

Saves the checkpoint persistently on the local storage.

Returns
  • true if the checkpoint was saved successfully, false otherwise.

public Single<Boolean> saveCheckpointAsync ()

Saves the checkpoint asynchronously.

Scheduler:
saveCheckpointAsync does not operate by default on a particular Scheduler.

Returns
  • Single returning true if the checkpoint was saved, false otherwise.

public void setStrategy (PdfDocumentCheckpointingStrategy strategy)

Sets the strategy to use for saving the checkpoint. See PdfDocumentCheckpointingStrategy for exact behaviour.

Parameters
strategy Strategy to use for saving the checkpoint.