Text::PDF::Dict(3pm)
π 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 bothstreamandstreamfileare 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
- ubuntu noble: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- ubuntu resolute: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- ubuntu stonking: libtext-pdf-perl 0.31-3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms