Text::PDF::Dict(3pm)

πŸ“¦
version 0.31 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Text::PDF::Dict β€” PDF Dictionaries and Streams πŸ’–

okay bestie, so this is Text::PDF::Dict, from the Text::PDF family (a perl module, obvi), and it's giving PDF Dictionaries and Streams energy. It inherits from PDF::Objind, so all that parent-class goodness comes along for the ride. πŸŽ€


✨ INSTANCE VARIABLES ✨

so there are these lil special instance variables that exist to look after stuff β€” especially streams, like that's their whole job. the little plot twist? each one of them starts with a space. yes, fr fr, a literal space. don't @ me, that's just the lore. πŸ’…

  • stream β€” holds the stream contents for output. that's it, that's the vibe. πŸ¦‹
  • streamfile β€” holds the stream contents in an external file instead of in memory. important: this is not the same thing as a PDF file stream, okay? the data gets stored in its unfiltered form. don't confuse the two, i'm begging. 😭
  • streamloc β€” if both stream and streamfile are empty, then this tells you where in the source PDF the stream starts. it's the backup plan of backup plans. ✨

🌸 METHODS 🌸

$d->outobjdeep($fh)

outputs the contents of the dictionary to a PDF file. and babes, it's a recursive call, so it goes deep β€” hence the name, iykyk. πŸŒ€

it also outputs a stream if the dictionary has a stream element. and if that happens? this method will calculate the length of the stream and insert it into the stream's dictionary. doing the math and the admin, we love a multitasker. πŸ‘‘

$d->read_stream($force_memory)

reads in a stream from a PDF file. here's the tea: if the stream is greater than PDF::Dict::mincache bytes to be stored β€” and that defaults to 32768 β€” then the default behavior is to create a file for it somewhere and use that file as a data cache. very demure, very mindful, very disk-based. πŸ’Ύ

but if $force_memory is set, that caching will not happen, and the data will all be stored in the $self->{' stream'} variable instead. memory it is. 🧠✨

$d->val

returns the dictionary. which is itself. it's giving main character energy honestly β€” it just hands you back its whole self. πŸ’œ

$d->copy($inpdf, $res, $unique, $outpdf, %opts)

copies an object. for all the deets, go see Text::PDF::Objind::Copy(). that's where the real instructions live. 🫢


and that's the whole page bestie, no cap. this gorgeous lil manpage is from perl v5.36.0, dated 2022-10-22, and it's filed under Text::PDF::Dict(3pm). slay, go read your PDFs. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from