PDF::AP...::Objind(3)
β¨ NAME β¨
okay so bestie, meet PDF::API2::Basic::PDF::Objind β a low-level PDF indirect object. that's the whole vibe. it's the little building block, the main character of the low-level PDF world π
π INSTANCE VARIABLES π
first thing you gotta know: these are not like content variables. instance variables all start with a space. yes, a literal leading space. that's the tell. iykyk π«Ά
parentβ if this object is a reference to an object living in some source, this holds the reference to the source object. so like, if the reference ever needs to be de-referenced, we know exactly where to go get the info. it's giving "i know a guy" πobjnum(R) β the object number in the source. only for object references tho, don't get it twisted.objgen(R) β the object generation in the source.isfreeβ marks whether the object is in the free list and available for re-use as another object somewhere else in the file. basically its "am i single and ready to mingle" flag πnextfreeβ holds a direct reference to the next free object in the free list. the group chat of free objects, fr fr.
also, there are other instance variables which are used by the parent for file control. secret ones. they exist, they're just not on this list π
πΈ METHODS πΈ
PDF::API2::Basic::PDF::Objind->new()
Creates a new indirect object β¨ fresh out the box, no notes.
uid
Returns a Unique id for this object β and if it didn't have one before, it makes one. very "i'll make my own id, i don't need anyone" energy π
$r->release
Releases ALL of the memory used by this indirect object, and all of its component/child objects. all of it. every crumb. this method gets called automatically by PDF::API2::Basic::PDF::File->release β so bestie, you do not have to call it yourself π«Ά
β οΈ note: it is important that this method get called at some point prior to the actual destruction of the object. why? because internally, PDF files have an enormous amount of cross-references, and that causes circular references within our own internal data structures. calling release() forces these circular references to be cleaned up and the entire internal data structure purged. it's the deep clean. the reset. the letting go π§
$r->val
Returns the value of this object, or reads the object and then returns its value. either way you get the value, periodt.
β οΈ note that all direct subclasses must make their own versions of this subroutine β otherwise we could be in for a very deep loop! π not the infinite recursion bestie, we do not do that here.
$r->realise
Makes sure that the object is fully read in, etc. she's realised. she's aware. she's fully loaded π
$r->outobjdeep($fh, $pdf)
If you really want to output this object, then you must need to read it first. also means that all direct subclasses must subclass this method or loop forever! π forever is a long time bestie.
$r->outobj($fh)
If this is a full object, then it outputs a reference to the object. otherwise it calls outobjdeep to output the contents of the object at this point. split decision, both valid π
$r->elements
Abstract superclass function filler. returns self here, but should return something more useful if an array. it's a placeholder, it's doing its best π
$r->empty
Empties all content from this object to free up memory, or to be read so it can be passed into the free list. simplistically, it undefs all instance variables other than object number and generation. like cleaning your room but keeping the two things that actually matter β¨
$r->merge($objind)
This merges content information into an object reference place-holder. this happens when an object reference gets read before the object definition, and the information in the read data needs to be merged into the object place-holder. gluing the info into the empty seat until the real one shows up π«Ά
$r->is_obj($pdf)
Returns whether this object is a full object with its own object number, or whether it's purely a sub-object. $pdf indicates which output file we're concerned that the object is an object in. main character or supporting role, we gotta know π
$r->copy($pdf, $res)
Returns a new copy of this object. the object is assumed to be some kind of associative array, and the copy is a deep copy for elements which are not PDF objects (according to $pdf), and a shallow copy for those that are. notice that calling copy on an object forces at least a one level copy even if it is a PDF object. the returned object loses its PDF object status though. she's reinvented herself, no longer a PDF object, just a girl π
If $res is defined, then the copy goes into that object rather than creating a new one. it is up to the caller to bless $res, etc. notice that elements from $self are not copied into $res if there is already an entry for them existing in $res. no duplicates, we respect the existing residents β¨
and that's the whole page bestie, you ate it π this was brought to you by perl v5.42.0, dated 2025-09-01 β slay, bye ππ¦
π¦ 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