diff --git a/lib/PDF/Catalog.rakumod b/lib/PDF/Catalog.rakumod index 0c92ce9..b0d341d 100644 --- a/lib/PDF/Catalog.rakumod +++ b/lib/PDF/Catalog.rakumod @@ -220,7 +220,7 @@ method cb-init { # vivify pages root self //= PDF::COS::Name.COERCE: 'Catalog'; - self //= PDF::COS::Dict.COERCE: { + self //= { :Type( :name ), :Count(0), :Kids[], diff --git a/lib/PDF/Class.rakumod b/lib/PDF/Class.rakumod index 0d42755..61b9b1d 100644 --- a/lib/PDF/Class.rakumod +++ b/lib/PDF/Class.rakumod @@ -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 { . ~~ 'Catalog' }; # autoloaded PDF::Catalog +my subset CatalogLike of Associative where { . ~~ 'Catalog' }; # autoloaded PDF::Catalog has CatalogLike $.Root is entry(:required, :indirect, :alias); #= 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 @@ -41,8 +43,7 @@ method version is rw { Version.new: $.catalog // self.?reader.?version // '1.4' }, STORE => -> $, Version $_ { - my PDF::COS::Name() $name = .Str; - $.catalog = $name; + $.catalog = name($_); }, ); } @@ -92,8 +93,8 @@ method permitted(UInt $flag --> Bool) { method cb-init { unless self { - self = { :Type( :name ) }; - self.cb-init; + self = { Type => name('Catalog') }; + self.?cb-init; } }