View on GitHub

PDF-Tags-raku

Tagged PDF writer

[Raku PDF Project] / [PDF-Tags Module] / PDF::Tags :: Mark

class PDF::Tags::Mark

Marked content reference

Synopsis

use PDF::Content::Tag :StructureTags, :ParagraphTags;
use PDF::Tags;
use PDF::Tags::Elem;
use PDF::Tags::Mark;

# PDF::Class
use PDF::Class;
use PDF::Page;

my PDF::Class $pdf .= new;
my PDF::Tags $tags .= create: :$pdf;
# create the document root
my PDF::Tags::Elem $doc = $tags.Document;

my PDF::Page $page = $pdf.add-page;

$page.graphics: -> $gfx {

    my PDF::Tags::Mark $mark = $doc.Paragraph.mark: $gfx, {
        .say: 'Marked paragraph text', :position[50, 100];
    }

    note $mark.name.Str;         # 'P'
    note $mark.attributes<MCID>; # 0
    note $mark.value.gist;       # <P MCID="0"/>
    note $mark.parent.text;      # 'Marked paragraph text'
    note $mark.parent.xml;       # '<P>Marked paragraph text</P>'
}

Description

A mark is a reference to an area of marked content within a page or xobject form’s content stream. A mark is a leaf node of a tagged PDF’s logical structure and is usually parented by a PDF::Tags::Elem object.

Notes:

Methods

method name

use PDF::Tags::Node :TagName;
method name () returns TagName;

The tag, as it appears in the marked content stream.

method attributes

method attributes() returns Hash;

The raw dictionary, as it appears in the marked content stream.

method mcid

method mcid() returns UInt

The Marked Content ID within the content stream. These are usually numbered in sequence, within a stream, starting at zero.

method value

method value() returns PDF::Content::Tag

The low-level PDF::Content::Tag object, which contains further details on the tag: