class PDF::Writer::Object::Info

Define the document information – metadata.

Constants

Info

Public Class Methods

new(parent) click to toggle source
Calls superclass method PDF::Writer::Object::new
   # File lib/pdf/writer/object/info.rb
14 def initialize(parent)
15   super(parent)
16 
17   @parent.instance_variable_set('@info', self)
18   @creationdate = Time.now
19 
20   @creator  = File.basename($0)
21   @producer = "PDF::Writer for Ruby"
22   @title    = nil
23   @author   = nil
24   @subject  = nil
25   @keywords = nil
26   @moddate  = nil
27   @trapped  = nil
28 end

Public Instance Methods

to_s() click to toggle source
   # File lib/pdf/writer/object/info.rb
34 def to_s
35   res = "\n#{@oid} 0 obj\n<<\n"
36   Info.each do |i|
37     v = __send__("#{i.downcase}".intern)
38     next if v.nil?
39     res << "/#{i} ("
40     if v.kind_of?(Time)
41       s = "D:%04d%02d%02d%02d%02d"
42       v = v.utc
43       v = s % [ v.year, v.month, v.day, v.hour, v.min ]
44     end
45 
46     res << PDF::Writer.escape(v)
47     res << ")\n"
48   end
49   res << ">>\nendobj"
50 end