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 198 198: def EncryptedPdfObject(obj, key, id, gen, in_content_stream=false) 199: case obj 200: when Array 201: "[" << obj.map { |e| 202: EncryptedPdfObject(e, key, id, gen, in_content_stream) 203: }.join(' ') << "]" 204: when Prawn::LiteralString 205: # FIXME: encrypted? 206: obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" } 207: "(#{obj})" 208: when Time 209: # FIXME: encrypted? 210: obj = obj.strftime("D:%Y%m%d%H%M%S%z").chop.chop + "'00'" 211: obj = obj.gsub(/[\\\n\(\)]/) { |m| "\\#{m}" } 212: "(#{obj})" 213: when String 214: PdfObject( 215: ByteString.new(Document::Security.encrypt_string(obj, key, id, gen)), 216: in_content_stream) 217: when Hash 218: output = "<< " 219: obj.each do |k,v| 220: unless String === k || Symbol === k 221: raise Prawn::Errors::FailedObjectConversion, 222: "A PDF Dictionary must be keyed by names" 223: end 224: output << PdfObject(k.to_sym, in_content_stream) << " " << 225: EncryptedPdfObject(v, key, id, gen, in_content_stream) << "\n" 226: end 227: output << ">>" 228: when Prawn::NameTree::Value 229: PdfObject(obj.name) + " " + 230: EncryptedPdfObject(obj.value, key, id, gen, in_content_stream) 231: else # delegate back to PdfObject 232: PdfObject(obj, in_content_stream) 233: end 234: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.