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.
void onAnnotationZOrderChanged(int pageIndex, List<Annotation> oldOrder, List<Annotation> newOrder)
Called when the z-order of annotations has changed on a specified page.
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.

Parameters
annotation Annotation that has been created.

public void onAnnotationRemoved (Annotation annotation)

Called when existing annotation has been removed.

Parameters
annotation Annotation that has been removed.

public void onAnnotationUpdated (Annotation annotation)

Called when existing annotation has changed.

Parameters
annotation Annotation that has been changed.

public void onAnnotationZOrderChanged (int pageIndex, List<Annotation> oldOrder, List<Annotation> newOrder)

Called when the z-order of annotations has changed on a specified page.

Parameters
pageIndex Index of the page where the z-order has changed.
oldOrder The old order of annotations on the page.
newOrder The new order of annotations on the page.

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.