Module: PDF::Core::EmbeddedFiles

Included in:
Prawn::Attachment
Defined in:
lib/pdf/core/embedded_files.rb

Overview

:nodoc:

Constant Summary collapse

NAME_TREE_CHILDREN_LIMIT =

The maximum number of children to fit into a single node in the EmbeddedFiles tree.

20

Instance Method Summary collapse

Instance Method Details

#add_embedded_file(name, reference) ⇒ Object Also known as: attach_file

Adds a new embedded file to the EmbeddedFiles name tree (see #embedded_files). The reference parameter will be converted into a PDF::Core::Reference if it is not already one.



27
28
29
30
# File 'lib/pdf/core/embedded_files.rb', line 27

def add_embedded_file(name, reference)
  reference = ref!(reference) unless reference.is_a?(PDF::Core::Reference)
  embedded_files.data.add(name, reference)
end

#embedded_filesObject

The EmbeddedFiles name tree in the Name dictionary (see Prawn::Document::Internal#names). This name tree is used to store named embedded files (PDF spec 3.10.3). (For more on name trees, see section 3.8.4 in the PDF spec.)



15
16
17
18
19
20
21
# File 'lib/pdf/core/embedded_files.rb', line 15

def embedded_files
  bump_min_version

  names.data[:EmbeddedFiles] ||= ref!(
    PDF::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT)
  )
end