The contents objects hold all of the content which appears on pages
# File lib/pdf/writer/object/contents.rb, line 39 def <<(v) raise TypeError unless v.kind_of?(PDF::Writer::Object) or v.kind_of?(String) @data << v end
# File lib/pdf/writer/object/contents.rb, line 44 def add(a) a.each { |k, v| @info[k] = v } end
# File lib/pdf/writer/object/contents.rb, line 35 def each @contents.each { |c| yield c } end
# File lib/pdf/writer/object/contents.rb, line 31 def size @data.size end
# File lib/pdf/writer/object/contents.rb, line 48 def to_s tmp = @data.dup res = "\n#{@oid} 0 obj\n" if @raw res << tmp else res << "<<" if PDF::Writer::Compression and @parent.compressed? res << " /Filter /FlateDecode" tmp = Zlib::Deflate.deflate(tmp) end @info.each { |k, v| res << "\n/#{k} #{v}" } res << "\n/Length #{tmp.size} >>\nstream\n#{tmp}\nendstream" end res << "\nendobj\n" res end
# File lib/pdf/writer/object/contents.rb, line 13 def initialize(parent, page = nil) super(parent) @data = "" @info = {} @raw = false @on_page = nil if page.kind_of?(PDF::Writer::Object::Page) @on_page = page elsif page == :raw @raw = true end end