Tag

[Raku PDF Project] / [PDF-Content Module] / PDF::Content :: Tag

class PDF::Content::Tag

Tagged and marked content

Description

This class assists in the detection or construction of tagged and marked content in page or xobject form content streams:

Example

use lib 't';
use PDFTiny;
use PDF::Content::XObject;
use PDF::Content::Tag :ParagraphTags, :IllustrationTags;

my PDFTiny $pdf .= new;

my $page = $pdf.add-page;
my $header-font = $pdf.core-font: :family<Helvetica>, :weight<bold>;
my $body-font = $pdf.core-font: :family<Helvetica>;

$page.graphics: -> $gfx {
    my PDF::Content::Tag $tag;

    $tag = $gfx.mark: Header1, {
        .say('Header text',
             :font($header-font),
             :font-size(15),
             :position[50, 120]);
    }

    say $tag.name.Str; # 'H1'
    say $tag.mcid;     # marked content id of 0

    $tag = $gfx.mark: Paragraph, {
        .say('Paragraph that contains a figure', :position[50, 100], :font($body-font), :font-size(12));

        # nested tag. Note: marks cannot be nested, but tags can
        .tag: Figure, {
            my PDF::Content::XObject $img .= open: "t/images/lightbulb.gif";
            .do: $img, :position[50,70];
        }

    }

    say $tag.name.Str;         # 'P'
    say $tag.mcid;             # marked content id of 1
    say $tag.kids[0].name.Str; # 'Figure'
}

say $page.gfx.tags.gist; # '<H1 MCID="0"/><P MCID="1"><Figure/></P>';

Methods

See [PDF 32000 Tables 333 - Standard structure types for grouping elements]

See [PDF 32000 Tables 334-337 - Block-level structure elements]

See [PDF 32000 Table 338 - Standard structure types for inline-level structure elements]

These tags are meaningful within content streams, as opposed to the structure-tree

multi method add-kid

multi method add-kid(
    PDF::Content::Tag $kid
) returns PDF::Content::Tag

Add a child tag

method take-descendants

method take-descendants() returns Mu

take self and all descendants

method descendants

method descendants() returns Seq

gather all descendants

PDF::Content v0.9.11

PDF content related classes; including text, images, fonts and graphics

Authors

  • David Warring

License

Artistic-2.0

Dependencies

Base64::NativeColorCompress::Zlib::RawFont::AFM:ver<1.24.10+>Native::PackingMethod::AlsoJSON::FastPDF:ver<0.6.8+>PDF::Grammar:ver<0.3.2+>

Test Dependencies

Provides

  • PDF::Content
  • PDF::Content::API
  • PDF::Content::Canvas
  • PDF::Content::Color
  • PDF::Content::Font
  • PDF::Content::Font::CoreFont
  • PDF::Content::Font::Enc::Glyphic
  • PDF::Content::Font::Enc::Type1
  • PDF::Content::Font::Encoder
  • PDF::Content::Font::Encodings
  • PDF::Content::FontObj
  • PDF::Content::Image
  • PDF::Content::Image::GIF
  • PDF::Content::Image::JPEG
  • PDF::Content::Image::PDF
  • PDF::Content::Image::PNG
  • PDF::Content::Interface
  • PDF::Content::Matrix
  • PDF::Content::Ops
  • PDF::Content::Page
  • PDF::Content::PageNode
  • PDF::Content::PageTree
  • PDF::Content::ResourceDict
  • PDF::Content::Resourced
  • PDF::Content::Tag
  • PDF::Content::Text::Block
  • PDF::Content::Text::Box
  • PDF::Content::Text::Line
  • PDF::Content::Text::Style
  • PDF::Content::XObject
  • X::PDF::Content

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.