Skip to content

Commit

Permalink
tweak cb-init()
Browse files Browse the repository at this point in the history
  • Loading branch information
dwarring committed Oct 12, 2024
1 parent c06021f commit eefab46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/PDF/Catalog.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ method cb-init {
# vivify pages root
self<Type> //= PDF::COS::Name.COERCE: 'Catalog';

self<Pages> //= PDF::COS::Dict.COERCE: {
self<Pages> //= {
:Type( :name<Pages> ),
:Count(0),
:Kids[],
Expand Down
11 changes: 6 additions & 5 deletions lib/PDF/Class.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ use PDF::Class::Type;
use PDF::Info;
use PDF::Content::Font::CoreFont;

sub name(PDF::COS::Name() $_) { $_ }

has PDF::Info $.Info is entry(:indirect); #= (Optional; must be an indirect reference) The document’s information dictionary
my subset CatalogLike of PDF::Class::Type where { .<Type> ~~ 'Catalog' }; # autoloaded PDF::Catalog
my subset CatalogLike of Associative where { .<Type> ~~ 'Catalog' }; # autoloaded PDF::Catalog
has CatalogLike $.Root is entry(:required, :indirect, :alias<catalog>); #= The catalog dictionary for the PDF document contained in the file

has PDF::COS::Type::XRef $.XRefStm is entry; #= Only applicable to Hybrid cross reference streams
Expand All @@ -41,8 +43,7 @@ method version is rw {
Version.new: $.catalog<Version> // self.?reader.?version // '1.4'
},
STORE => -> $, Version $_ {
my PDF::COS::Name() $name = .Str;
$.catalog<Version> = $name;
$.catalog<Version> = name($_);
},
);
}
Expand Down Expand Up @@ -92,8 +93,8 @@ method permitted(UInt $flag --> Bool) {

method cb-init {
unless self<Root> {
self<Root> = { :Type( :name<Catalog> ) };
self<Root>.cb-init;
self<Root> = { Type => name('Catalog') };
self<Root>.?cb-init;
}
}

Expand Down

0 comments on commit eefab46

Please sign in to comment.