CAM::P...::Text(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::Renderer::Text πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation (iykyk, that's the manual name, she's fancy like that) and we're about to make an ASCII renderer make sense. slay. πŸŽ€

✨ NAME ✨

CAM::PDF::Renderer::Text β€” Render an ASCII image of a PDF page πŸ¦‹

Like, it turns a PDF page into little text-art. it's giving pixel art but make it typography.

πŸ“œ LICENSE πŸ“œ

See CAM::PDF. periodt. πŸ’…

🌸 SYNOPSIS 🌸

use CAM::PDF;
my $pdf = CAM::PDF->new($filename);
my $contentTree = $pdf->getPageContentTree(4);
$contentTree->render("CAM::PDF::Renderer::Text");

that's the whole vibe right there. no cap. ✨

πŸ‘‘ DESCRIPTION πŸ‘‘

So this class? It prints to STDOUT the coordinates of every single node of a page layout. Every. Single. One. πŸ”₯

It was written for two reasons and honestly both are iconic:

  • debugging πŸ›
  • as a minimal example of a renderer β€” like the "hello world" of renderers, lowkey

🌈 GLOBALS 🌈

Two globals, two icons, and they control everything:

  • $CAM::PDF::Renderer::Text::xdensity and $CAM::PDF::Renderer::Text::ydensity β€” these two besties define the scale of the ASCII graphical output device. That's literally their whole job.

And the default for both? 6.0. Both of them. fr fr. 🌟

🧚 FUNCTIONS 🧚

  • $pkg->new() β€” calls the superclass constructor, and initializes the ASCII PDF page. main character energy: it sets the whole thing up before anyone else gets to do anything. πŸ’–
  • $self->renderText($string) β€” prints the characters of the screen to our virtual ASCII framebuffer. yes, we have a framebuffer and yes it's made of vibes and text. 🫢
  • $self->toString() β€” serializes the framebuffer into a single string that can be easily printed. one string. clean. ate. πŸ’…

πŸ’œ AUTHOR πŸ’œ

See CAM::PDF 😌


okay that's the whole page, bestie. πŸŽ€ this was perl v5.36.0, dated 2022-12-08, and it lives in the User Contributed Perl Documentation section of the manual. ty for coming to my ted talk, go render something cute. πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from