[Raku PDF Project] / [PDF-Tags Module] / PDF::Tags :: Node
class PDF::Tags::Node
Abstract Node
Methods
method cos
Returns the underlying PDF::Class or PDF::Content object. The PDF::Tags::Node subclass and PDF::COS type are mapped as follows:
PDF::Tags::Node object | PDF::Class object |Base class | Notes | |
---|---|---|---|
PDF::Tags | PDF::StructTreeRoot | PDF::Tags::Node::Parent | PDF structure tree root |
PDF::Tags::Elem | PDF::StructElem | PDF::Tags::Node::Parent | Intermediate structure element node |
PDF::Tags::Mark | PDF::MCR | PDF::Tags::Parent | Leaf marked content reference |
PDF::Tags::ObjRef | PDF::OBJR | PDF::Tags::Node | Leaf object reference |
PDF::Tags::Text | N/A | PDF::Tags::Node | Looking to eliminate this class? |
method root
method root() returns PDF::Tags
Link to the structure tree root.
method find (alias AT-KEY)
method find is also<AT-KEY> returns Seq
say $tags.find('Document/L[1]/@O')[0].name'
say $tags<Document/L[1]/@O>[0].name'
This method evaluates an XPath like expression (see PDF::Tags::XPath) and returns a sequence of matching nodes.
With the exception that $node.AT-KEY($node-name)
routes to $node.Hash{$node-name}
, rather than using the XPath engine.
method first
method first($expr) returns PDF::Tags::Node
say $tags.first('Document/L[1]/@O').name;
Like find, except the first matching node is returned.
method xml
method xml(*%opts) returns Str
Serialize a node and any descendants as XML.
Calling $node.xml(|c)
, is equivalent to: PDF::Tags::XML-Writer.new(|c).Str($node)