class PDF::Document::Encrypt

Overview

A PDF document can be encrypted (PDF 1.1) to protect its contents from unauthorized access.

Encryption applies to all strings and streams in the document’s PDF file, but not to other object types such as integers and boolean values, which are used primarily to convey information about the document’s structure rather than its content. Leaving these values unencrypted allows random access to the objects within a document, while encrypting the strings and streams protects the document’s substantive contents.

Note: When a PDF stream object (see Section 3.2.7, “Stream Objects”) refers to an external file, the stream’s contents are not encrypted, since they are not part of the PDF file itself. However, if the contents of the stream are embedded within the PDF file (see Section 3.10.3, “Embedded File Streams”), they are encrypted like any other stream in the file.

Encryption is controlled by an encryption dictionary, which is the value of the Encrypt entry in the document’s trailer dictionary (see Table 3.11 on page 61). If this entry is absent from the trailer dictionary, the document is not encrypted. The entries shown in Table 3.12 are common to all encryption dictionaries.

Defined in:

pdf/document/encrypt.cr

Constant Summary

DEFAULT = 0

Constructors

Instance Method Summary

Constructor Detail

def self.new(filter : PDF::Name, v : Int32 | Nil = nil) #

[View source]

Instance Method Detail

def to_h : Hash(String, Name) #

[View source]