Namespace: Options

PSPDFKit.Options

Custom values for default options. These values will be frozen the first time PSPDFKit.load is called, and won't be modifiable after that.

Example

Set minimum ink annotation size.

PSPDFKit.Options.MIN_INK_ANNOTATION_SIZE = 64;
PSPDFKit.load();

Members

Type Definitions




Members

COLOR_PRESETS: Array.<ColorPreset>

The list of colors to use for color dropdowns in annotation toolbars.

Type:
Default Value:
  • Red, Orange, Yellow, Green, Blue, Purple, Pink, Light Orange, Light Yellow, Light Green, Light Blue, Mauve, Transparent, White, Light Grey, Grey, Dark Grey, Black
Example
PSPDFKit.Options.COLOR_PRESETS = [
{
   color: new PSPDFKit.Color({ r: 255, g: 0, b: 0 }),
   localization: {
     id: "brightRed",
     defaultMessage: "Bright Red"
   }
 },
{
   color: new PSPDFKit.Color({ r: 0, g: 0, b: 180 }),
   localization: {
     id: "deepBlue",
     defaultMessage: "Deep Blue"
   }
 },
{
   color: null,
   localization: {
     id: "transparent",
     defaultMessage: "Transparent"
   }
 }
];

DEFAULT_INK_ERASER_CURSOR_WIDTH: number

Set the default width of the ink eraser cursor.

Type:
  • number
Default Value:
  • false

DISABLE_KEYBOARD_SHORTCUTS: boolean

Disable all the PSPDFKit keyboard shortcuts.

Type:
  • boolean
Default Value:
  • false

ENABLE_INK_SMOOTH_LINES: boolean

Enable smooth lines for ink annotations.

Type:
  • boolean
Default Value:
  • true

HIGHLIGHT_COLOR_PRESETS: Array.<ColorPreset>

The list of colors to use in the text highlight annotation toolbar. You can't use transparent for this.

Type:
Default Value:
  • Light Yellow, Light Blue, Light Green, Light Red
Example
PSPDFKit.Options.HIGHLIGHT_COLOR_PRESETS = [
{
   color: new PSPDFKit.Color({ r: 255, g: 0, b: 0 }),
   localization: {
     id: "brightRed",
     defaultMessage: "Bright Red"
   }
 },
{
   color: new PSPDFKit.Color({ r: 0, g: 0, b: 180 }),
   localization: {
     id: "deepBlue",
     defaultMessage: "Deep Blue"
   }
 }
];

IGNORE_DOCUMENT_PERMISSIONS: boolean

Enables all the features by ignoring the document permissions.

Type:
  • boolean
Default Value:
  • false

INITIAL_DESKTOP_SIDEBAR_WIDTH: number

The default width of the sidebar on desktop browsers.

Type:
  • number
Default Value:
  • 300

INK_EPSILON_RANGE_OPTIMIZATION: number

Minimum range between two points for an ink annotation, in pixels. If set to 0, the optimization is disabled.

Type:
  • number
Default Value:
  • 10

LINE_CAP_PRESETS: Array.<LineCapPresets>

The list of line caps to use for dropdowns in annotation toolbars.

Type:
Default Value:
  • ["none", "square", "circle", "diamond", "openArrow", "closedArrow", "butt", "reverseOpenArrow", "reverseClosedArrow", "slash"]
Example
PSPDFKit.Options.LINE_CAP_PRESETS = ["openArrow", "closedArrow", "none"];

LINE_WIDTH_PRESETS: Array.<number>

The list of line widths to use for dropdowns in annotation toolbars.

Type:
  • Array.<number>
Default Value:
  • null
Example
PSPDFKit.Options.LINE_WIDTH_PRESETS = [1, 2, 4, 8, 32];

MIN_IMAGE_ANNOTATION_SIZE: number

Minimum size of image annotations, in pixels.

Type:
  • number
Default Value:
  • 5

MIN_INK_ANNOTATION_SIZE: number

Minimum size of ink annotations, in pixels.

Type:
  • number
Default Value:
  • 16

MIN_SHAPE_ANNOTATION_SIZE: number

Minimum size of shape annotations, in pixels.

Type:
  • number
Default Value:
  • 16

MIN_STAMP_ANNOTATION_SIZE: number

Minimum size of stamp annotations, in pixels.

Type:
  • number
Default Value:
  • 15

MIN_TEXT_ANNOTATION_SIZE: number

Minimum size of text annotations, in pixels.

Type:
  • number
Default Value:
  • 5

NOTE_COLOR_PRESETS: Array.<ColorPreset>

The list of colors to use for note annotations. You can't pass transparent color as an option.

Type:
Default Value:
  • Yellow, Orange, Red, Fuchsia, Blue, Green
Example
PSPDFKit.Options.NOTE_COLOR_PRESETS = [
{
   color: new PSPDFKit.Color({ r: 255, g: 0, b: 0 }),
   localization: {
     id: "brightRed",
     defaultMessage: "Bright Red"
   }
 },
{
   color: new PSPDFKit.Color({ r: 0, g: 0, b: 180 }),
   localization: {
     id: "deepBlue",
     defaultMessage: "Deep Blue"
   }
 }
 }
];

PDF_JAVASCRIPT: boolean
Standalone Only

Enables PDF JavaScript support. PDF documents may contain JavaScript for interactivity. This enables things like form validation, formatting, or automatic calculation which are performed by a JavaScript scripts inside the PDF document.

Disabling JavaScript improves the general performance of the framework when PDF JavaScript support is not needed.

This feature is only available on standalone deployments for now.

Type:
  • boolean
Default Value:
  • true

Defines the radius of the resize anchors in px.

Type:

Defines the padding between the annotation and the selection outline on px.

Type:

SELECTION_STROKE_WIDTH: number

Stroke width of the selection outline rectangle in px.

Type:
  • number
Default Value:
  • 2

SIGNATURE_SAVE_MODE: PSPDFKit.SignatureSaveMode

Saving strategy for ink signatures.

Type:
Default Value:
  • PSPDFKit.SignatureSaveMode.USING_UI

TEXT_ANNOTATION_AUTOFIT_BOUNDING_BOX_ON_EDIT: boolean

Control whether PSPDFKit should adjust the text annotations' bounding box to fit the text in the annotation when editing it.

Type:
  • boolean
Default Value:
  • true

TEXT_ANNOTATION_AUTOFIT_TEXT_ON_EXPORT: boolean

Control whether PSPDFKit should adjust the font size to fit the text in the annotation bounding box when exporting the annotation.

Type:
  • boolean
Default Value:
  • true

TEXT_MARKUP_COLOR_PRESETS: Array.<ColorPreset>

The list of colors to use in the text markup annotation toolbar.

Type:
Default Value:
  • Black, Blue, Red, Green
Example
PSPDFKit.Options.TEXT_MARKUP_COLOR_PRESETS = [
{
   color: new PSPDFKit.Color({ r: 255, g: 0, b: 0 }),
   localization: {
     id: "brightRed",
     defaultMessage: "Bright Red"
   }
 },
{
   color: new PSPDFKit.Color({ r: 0, g: 0, b: 180 }),
   localization: {
     id: "deepBlue",
     defaultMessage: "Deep Blue"
   }
 }
];

Type Definitions

ResizeAnchorRadiusCallback(viewportSize) → {number}

Receives a PSPDFKit.Geometry.Size object with the current viewport dimensions (width and height) and returns the radius of the selection resize / modification anchors in px.

The default implementation will increase the anchor radius on small device.

Parameters:
Name Type Description
viewportSize PSPDFKit.Geometry.Size
Returns:
Type
number

SelectionOutlinePaddingCallback(viewportSize) → {number}

Receives a PSPDFKit.Geometry.Size object with the current viewport dimensions (width and height) and returns the padding that will be added between an annotation and the selection outline in px.

The default implementation will increase the outline padding on small device.

Parameters:
Name Type Description
viewportSize PSPDFKit.Geometry.Size
Returns:
Type
number