Like PdfObject, but returns an encrypted result if required. For direct objects, requires the object identifier and generation number from the indirect object referencing obj.
# File lib/prawn/security.rb, line 197 def EncryptedPdfObject(obj, key, id, gen, in_content_stream=false) case obj when Array "[" << obj.map { |e| EncryptedPdfObject(e, key, id, gen, in_content_stream) }.join(' ') << "]" when Prawn::LiteralString # FIXME: encrypted? obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" } "(#{obj})" when Time # FIXME: encrypted? obj = obj.strftime("D:%Y%m%d%H%M%S%z").chop.chop + "'00'" obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" } "(#{obj})" when String PdfObject( ByteString.new(Document::Security.encrypt_string(obj, key, id, gen)), in_content_stream) when Hash output = "<< " obj.each do |k,v| unless String === k || Symbol === k raise Prawn::Errors::FailedObjectConversion, "A PDF Dictionary must be keyed by names" end output << PdfObject(k.to_sym, in_content_stream) << " " << EncryptedPdfObject(v, key, id, gen, in_content_stream) << "\n" end output << ">>" when Prawn::NameTree::Value PdfObject(obj.name) + " " + EncryptedPdfObject(obj.value, key, id, gen, in_content_stream) else # delegate back to PdfObject PdfObject(obj, in_content_stream) end end
Generated with the Darkfish Rdoc Generator 2.