CAM::PDF::GS(3pm)
π 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
- debian bookworm: libcam-pdf-perl 1.60-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcam-pdf-perl 1.60-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcam-pdf-perl 1.60-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcam-pdf-perl 1.60-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcam-pdf-perl 1.60-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms