CAM::PDF::GS(3pm)

πŸ“¦
version 1.60 Β· 2 versions
  • 1.60 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 1.60 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– CAM::PDF::GS πŸ’–

okay so bestie, welcome to CAM::PDF::GS β€” it's a Perl module from the User Contributed Perl Documentation collection, and it's literally the PDF graphic state, no cap. πŸŽ€


✨ NAME ✨

CAM::PDF::GS β€” PDF graphic state. that's it, that's the whole name, short and iconic. πŸ‘‘


πŸ“œ LICENSE πŸ“œ

See CAM::PDF. (yeah, the licensing deets live over there, we're not duplicating them here, iykyk)


🌈 SYNOPSIS 🌈

here's the vibe, copy-paste ready:

use CAM::PDF;
my $pdf = CAM::PDF->new($filename);
my $contentTree = $pdf->getPageContentTree(4);
my $gs = $contentTree->computeGS();

like. you load a PDF, you grab page 4's content tree, you compute the graphic state. that's the whole main character arc. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

This class is used to represent the graphic state at a point in the rendering flow of a PDF page. So like, imagine the PDF is being drawn line by line and you freeze-frame at one exact moment β€” the graphic state is everything the renderer knows right then. πŸ’…

Much of the functionality is actually based in the parent class, CAM::PDF::GS::NoText. So a lot of the actual work is inherited, not gonna lie.

Subclasses that want to do something useful with text should override the renderText() method. Yeah β€” by default text rendering is a whole lot of nothing, so if you want text to actually do something, that's your moment to shine. 🌟


πŸ’« CONVERSION FUNCTIONS πŸ’«

$self->getCoords($node)

Computes device coordinates for the specified node. This implementation handles text-printing nodes, and hands all other types to the superclass. (like, "not my job, ask my parent" energy 😌)

$self->textToUser($x, $y)

Convert text coordinates ("Tm") to user coordinates. Returns the converted X and Y.

$self->textToDevice($x, $y)

Convert text coordinates ("Tm") to device coordinates. Returns the converted X and Y.

$self->textLineToUser($x, $y)

Convert text coordinates ("Tlm") to user coordinates. Returns the converted X and Y.

$self->textLineToDevice($x, $y)

Convert text coordinates ("Tlm") to device coordinates. Returns the converted X and Y.

$self->renderText($string, $width)

A general method for rendering strings, from "Tj" or "TJ". This is a no-op, but subclasses may override. so yeah, out of the box it renders absolutely nothing β€” it's giving placeholder πŸ’€ β€” but override it and suddenly you're painting glyphs.

$self->Tadvance($width)

Move the text cursor. that's it. cursor go brrr. πŸƒβ™€οΈ


πŸŽ€ DATA FUNCTIONS πŸŽ€

these ones are just the signatures, bestie β€” no descriptions, so I'm not gonna invent any (that would be lying and we don't do that here πŸ™ˆ):

$self->BT()

$self->Tf($fontname, $fontsize)

$self->Tstar()

$self->Tz($scale)

$self->Td($x, $y)

$self->TD($x, $y)

$self->Tj($string)

$self->TJ($arrayref)

$self->quote($string)

$self->doublequote($tw, $tc, $string)

$self->Tm($m1, $m2, $m3, $m4, $m5, $m6)


πŸ‘‘ AUTHOR πŸ‘‘

See CAM::PDF.


and that's the whole page, bestie!! 🫢 this was CAM::PDF::GS(3pm) from perl v5.36.0, dated 2022-12-08, brought to you by the User Contributed Perl Documentation girlies. mwah, go compute some graphic states πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from