PDF::AP...DF::Dict(3)
π NAME π
PDF::API2::Basic::PDF::Dict β okay bestie, this is the low-level dictionary and stream object situation. It's a Perl man page from section 3 (User Contributed Perl Documentation), and it's giving "I'm the plumbing behind your PDFs" energy. No cap. π«Ά
β¨ INSTANCE VARIABLES β¨
So there are these special instance variables that exist mostly to babysit streams, and here's the iconic detail: every single one of them starts with a space. Yes, a literal space. That's not a typo, that's the whole vibe. π
streamβ holds the stream contents for output. Simple. Elegant. Main character.streamfileβ holds the stream contents in an external file instead of in memory. And ngl, important note: this is not the same as a PDF file stream. The data is stored in its unfiltered form. πstreamlocβ if bothstreamandstreamfileare empty, this tells you where in the source PDF the stream starts. It's the little map pin. π
π METHODS π
π¦ $type = $d->type($type)
Get/Set the standard Type key. You can pass it a text value and it'll hand you back a text value too β not a Name object. It's giving convenient. β¨
π¦ @filters = $d->filter(@filters)
Get/Set one or more filters that the optional stream attached to the dictionary is using. Plural filters, plural business. π
π¦ $d->outobjdeep($fh)
Outputs the contents of the dictionary to a PDF file. Heads up: this is a recursive call, so it goes deep-deep, iykyk. π₯
It also outputs a stream if the dictionary has a stream element. And when that happens? This method calculates the length of the stream and inserts it into the stream's dictionary. It's doing the math for you, bestie, you're welcome. π
π¦ $d->read_stream($force_memory)
Reads in a stream from a PDF file. Here's where it gets interesting: if the stream is greater than PDF::Dict::mincache bytes to be stored, the default action is to create a file for it somewhere and use that file as a data cache. And what's the default value of PDF::Dict::mincache? It's 32768. Remember that number, it might come up. π
But if $force_memory is set, that caching will not happen β the data all gets stored in the $self->{' stream'} variable instead. Straight into memory, no detours. π
π¦ $d->val
Returns the dictionary. Which is itself. It's the dictionary returning itself, which is honestly the most self-assured thing I've ever seen. π It's giving main character energy fr fr.
Okay but for real: those variable names all start with a space.stream,streamfile,streamloc. Miss that space and you're gonna have a bad time. π
And that's the whole page, bestie! π Sending you off with the deets from the footer: this was perl v5.42.0, dated 2025-09-01, and it lives under PDF::AP...DF::Dict(3) β slay, go forth and dictionary responsibly. πβ¨π¦
π¦ where this page comes from
- fedora 43: perl-PDF-API2 2.048-1.fc43 Β· LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND (MIT OR Artistic-1.0-Perl)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms