Class Origami::ContentStream
In: sources/parser/stream.rb
Parent: Stream

A class representing a Stream containing the contents of a Page.

Methods

<<   new   write  

Public Class methods

[Source]

     # File sources/parser/stream.rb, line 521
521:     def initialize(rawdata = "", dictionary = {})
522:     
523:       @contents = []
524:             
525:       super(rawdata, dictionary)
526:     end

Public Instance methods

Append text to the current content stream.

[Source]

     # File sources/parser/stream.rb, line 531
531:     def <<(text)
532:       
533:       if @contents.empty? 
534:         @contents << PS::Text.new(text)
535:       else
536:         @contents.last.buffer << text
537:       end
538:       
539:     end

Adds text to the content stream with custom formatting attributes.

text:Text to write.
attr:Formatting attributes.

[Source]

     # File sources/parser/stream.rb, line 546
546:     def write(text, attr = {})
547:       @contents << Origami::PS::Text.new(text, attr)
548:     end

[Validate]