Method: PDF::Reader::Page#walk
- Defined in:
- lib/pdf/reader/page.rb
#walk(*receivers) ⇒ Object
processes the raw content stream for this page in sequential order and passes callbacks to the receiver objects.
This is mostly low level and you can probably ignore it unless you need access to something like the raw encoded text. For an example of how this can be used as a basis for higher level functionality, see the text() method
If someone was motivated enough, this method is intended to provide all the data required to faithfully render the entire page. If you find some required data isn’t available it’s a bug - let me know.
Many operators that generate callbacks will reference resources stored in the page header - think images, fonts, etc. To facilitate these operators, the first available callback is page=. If your receiver accepts that callback it will be passed the current PDF::Reader::Page object. Use the Page#resources method to grab any required resources.
It may help to think of each page as a self contained program made up of a set of instructions and associated resources. Calling walk() executes the program in the correct order and calls out to your implementation.
109 110 111 112 |
# File 'lib/pdf/reader/page.rb', line 109 def walk(*receivers) callback(receivers, :page=, [self]) content_stream(receivers, raw_content) end |