Sha256: b7ca0729fbbd0b31cab88e707adeeb28bb978aee251183424f4b1b608b4bedbc

Contents?: true

Size: 1.24 KB

Versions: 22

Compression:

Stored size: 1.24 KB

Contents

#--
# PDF::Writer for Ruby.
#   http://rubyforge.org/projects/ruby-pdf/
#   Copyright 2003 - 2005 Austin Ziegler.
#
#   Licensed under a MIT-style licence. See LICENCE in the main distribution
#   for full licensing information.
#
# $Id: info.rb 177 2007-11-26 16:06:58Z sandal $
#++
  # Define the document information -- metadata.
class PDF::Writer::Object::Info < PDF::Writer::Object
  Info = %w{CreationDate Creator Title Author Subject Keywords ModDate Trapped Producer}
  def initialize(parent)
    super(parent)

    @parent.instance_variable_set('@info', self)
    @creationdate = Time.now

    @creator  = nil #File.basename($0)
    @producer = "PDF::Writer for Ruby"
    @title    = nil
    @author   = nil
    @subject  = nil
    @keywords = nil
    @moddate  = nil
    @trapped  = nil
  end

  Info.each do |i|
    attr_accessor i.downcase.intern
  end

  def to_s
    res = "\n#{@oid} 0 obj\n<<\n"
    Info.each do |i|
      v = __send__("#{i.downcase}".intern)
      next if v.nil?
      res << "/#{i} ("
      if v.kind_of?(Time)
        s = "D:%04d%02d%02d%02d%02d"
        v = v.utc
        v = s % [ v.year, v.month, v.day, v.hour, v.min ]
      end

      res << PDF::Writer.escape(v)
      res << ")\n"
    end
    res << ">>\nendobj"
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
rhodes-7.6.0 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-7.5.1 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-7.4.1 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-7.1.17 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-6.2.0 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-6.0.11 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.18 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.17 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.15 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.0.22 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.2 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.0.7 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.0.3 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-5.5.0 lib/extensions/pdf-writer/pdf/writer/object/info.rb
tauplatform-1.0.3 lib/extensions/pdf-writer/pdf/writer/object/info.rb
tauplatform-1.0.2 lib/extensions/pdf-writer/pdf/writer/object/info.rb
tauplatform-1.0.1 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-3.5.1.12 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-3.3.5 lib/extensions/pdf-writer/pdf/writer/object/info.rb
rhodes-3.4.2 lib/extensions/pdf-writer/pdf/writer/object/info.rb