public class

DocumentSaveOptions

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

Class Overview

Configures options for saving a document. Use those when saving a document via save(String, DocumentSaveOptions) or related save methods.

Summary

Public Constructors
DocumentSaveOptions(String password, EnumSet<DocumentPermissions> permissions, boolean incremental, PdfVersion pdfVersion)
Advanced options for saving a processed document.
Public Methods
String getPassword()
Returns the password that'll be set on the document if these options are used.
PdfVersion getPdfVersion()
Returns the PDF version of the document that'll be saved using these options.
EnumSet<DocumentPermissions> getPermissions()
Returns the permissions that'll be set on the document if saved using these options.
boolean isIncremental()
Indicates whether the saving is set to be incremental or not.
void setApplyRedactions(boolean applyRedactions)
Sets whether saving will apply redactions or not.
void setIncremental(boolean incremental)
Sets whether the saving will be incremental or not.
void setPassword(String password)
Sets the password to a document saving options.
void setPdfVersion(PdfVersion pdfVersion)
Sets the PDF version of the document that'll be saved using these options.
void setPermissions(EnumSet<DocumentPermissions> permissions)
Sets the permissions that'll be set on the document if saved using these options.
void setRewriteAndOptimizeFileSize(boolean rewriteAndOptimizeFileSize)
Sets whether when saving unnecessary data should be removed from the document causing smaller file sizes.
boolean shouldApplyRedactions()
Indicates whether RedactionAnnotations are applied as part of the save process.
boolean shouldRewriteAndOptimizeFileSize()
Indicates whether when saving unnecessary data should be removed from the document causing smaller file sizes.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DocumentSaveOptions (String password, EnumSet<DocumentPermissions> permissions, boolean incremental, PdfVersion pdfVersion)

Advanced options for saving a processed document.

Parameters
password Password in the output PDF document. Documents with password set are encrypted. null for no password.
permissions Permission flags on output document, a set of flags from DocumentPermissions.
incremental If true, PSPDFKit will attempt to only append incremental changes to the document instead of rewriting it. May not be possible in all cases.
pdfVersion Version of PDF to generate. If null, defaults to the newest one.

Public Methods

public String getPassword ()

Returns the password that'll be set on the document if these options are used.

Returns
  • Password set to these save options.

public PdfVersion getPdfVersion ()

Returns the PDF version of the document that'll be saved using these options.

Returns
  • PDF version of saved document.

public EnumSet<DocumentPermissions> getPermissions ()

Returns the permissions that'll be set on the document if saved using these options.

Returns
  • Permissions to be set on the document.

public boolean isIncremental ()

Indicates whether the saving is set to be incremental or not.

Returns
  • true if saving is incremental, false otherwise

public void setApplyRedactions (boolean applyRedactions)

Sets whether saving will apply redactions or not.

Parameters
applyRedactions true if redactions should be applied, false otherwise.
Throws
InvalidPSPDFKitLicenseException Exception is thrown if the current license doesn't have the redaction component.

public void setIncremental (boolean incremental)

Sets whether the saving will be incremental or not. Setting this to true will disable shouldRewriteAndOptimizeFileSize().

Parameters
incremental true to make saving incremental, false otherwise.

public void setPassword (String password)

Sets the password to a document saving options. This password will be set to the document if saved using these options.

Parameters
password Password to be set.

public void setPdfVersion (PdfVersion pdfVersion)

Sets the PDF version of the document that'll be saved using these options.

Parameters
pdfVersion PDF version of saved document, null default to the latest PDF version.

public void setPermissions (EnumSet<DocumentPermissions> permissions)

Sets the permissions that'll be set on the document if saved using these options.

Parameters
permissions Permissions to be set on the document.

public void setRewriteAndOptimizeFileSize (boolean rewriteAndOptimizeFileSize)

Sets whether when saving unnecessary data should be removed from the document causing smaller file sizes. Setting this to true will automatically disable incremental saving. When set to true this will lead to smaller file sizes than incremental saving or a regular rewrite at the expense of the saving process taking longer.

Parameters
rewriteAndOptimizeFileSize true if the file size should be optimized, false otherwise.

public boolean shouldApplyRedactions ()

Indicates whether RedactionAnnotations are applied as part of the save process.

Returns
  • true if they are applied, false otherwise.

public boolean shouldRewriteAndOptimizeFileSize ()

Indicates whether when saving unnecessary data should be removed from the document causing smaller file sizes. This is incompatible with incremental saving. This is slower than incremental saving or a regular rewrite and will increase the time saving takes.

Returns
  • true if the file size will be optimized, false otherwise.