Module: HexaPDF::Encryption::StandardSecurityHandler::Permissions

Defined in:
lib/hexapdf/encryption/standard_security_handler.rb

Overview

Defines all available permissions.

It is possible to use an array of permission symbols instead of an integer to describe the permission set. The used symbols are the lower case versions of the constants, i.e. the symbol for MODIFY_CONSTANT would be :modify_constant.

See: PDF2.0 s7.6.4.2

Constant Summary collapse

1 << 2
MODIFY_CONTENT =

Modification of the content by operations that are different from those controlled by MODIFY_ANNOTATION, FILL_IN_FORMS and ASSEMBLE_DOCUMENT

1 << 3
COPY_CONTENT =

Copying of content

1 << 4
MODIFY_ANNOTATION =

Modifying annotations

1 << 5
FILL_IN_FORMS =

Filling in form fields

1 << 8
EXTRACT_CONTENT =

Extracting content

PDF 2.0 specifies that this bit should always be set by writers and should be ignored by readers. Therefore this is part of the RESERVED constant.

1 << 9
ASSEMBLE_DOCUMENT =

Assembling of the document (inserting, rotating or deleting of pages and creation of bookmarks or thumbnail images)

1 << 10
HIGH_QUALITY_PRINT =

High quality printing

1 << 11
ALL =

Allows everything

PRINT | MODIFY_CONTENT | COPY_CONTENT | MODIFY_ANNOTATION | FILL_IN_FORMS |
EXTRACT_CONTENT | ASSEMBLE_DOCUMENT | HIGH_QUALITY_PRINT
RESERVED =

Reserved permission bits that should always be set

0xFFFFF000 | 0b11000000 | EXTRACT_CONTENT
SYMBOL_TO_PERMISSION =

Maps permission symbols to their respective value

{
  print: PRINT,
  modify_content: MODIFY_CONTENT,
  copy_content: COPY_CONTENT,
  modify_annotation: MODIFY_ANNOTATION,
  fill_in_forms: FILL_IN_FORMS,
  extract_content: EXTRACT_CONTENT,
  assemble_document: ASSEMBLE_DOCUMENT,
  high_quality_print: HIGH_QUALITY_PRINT,
}.freeze
PERMISSION_TO_SYMBOL =

Maps a permission value to its symbol

{
  PRINT => :print,
  MODIFY_CONTENT => :modify_content,
  COPY_CONTENT => :copy_content,
  MODIFY_ANNOTATION => :modify_annotation,
  FILL_IN_FORMS => :fill_in_forms,
  EXTRACT_CONTENT => :extract_content,
  ASSEMBLE_DOCUMENT => :assemble_document,
  HIGH_QUALITY_PRINT => :high_quality_print,
}.freeze