Class: PDF::Core::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn/security.rb

Experimental API collapse

Instance Method Details

#encrypted_object(key) ⇒ String

Returns the object definition for the object this references, keyed from ‘key`.

Parameters:

  • key (String)

Returns:

  • (String)


290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/prawn/security.rb', line 290

def encrypted_object(key)
  @on_encode&.call(self)

  output = +"#{@identifier} #{gen} obj\n"
  if @stream.empty?
    output <<
      PDF::Core.encrypted_pdf_object(data, key, @identifier, gen) << "\n"
  else
    output << PDF::Core.encrypted_pdf_object(
      data.merge(@stream.data), key, @identifier, gen,
    ) << "\n" <<
      @stream.encrypted_object(key, @identifier, gen)
  end

  output << "endobj\n"
end