From e2d243649b20aa79f986d411f405634e9adafca4 Mon Sep 17 00:00:00 2001 From: David Warring Date: Wed, 15 Nov 2023 07:29:45 +1300 Subject: [PATCH] Suppress writing of structural artifacts PDF 2.0 spec makes it clearer that these can be in the structure tree as well as at the content level. --- lib/PDF/Tags/XML-Writer.rakumod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PDF/Tags/XML-Writer.rakumod b/lib/PDF/Tags/XML-Writer.rakumod index 6164123..9835ef5 100644 --- a/lib/PDF/Tags/XML-Writer.rakumod +++ b/lib/PDF/Tags/XML-Writer.rakumod @@ -25,6 +25,7 @@ has Bool $.fields = True; has Bool $.valid = !$!marks && !$!roles; has Str $.omit; has Str $.root-tag; +has Bool $.artifacts = False; has Bool $!got-nl = True; has Bool $!feed; has Bool $!snug = True; @@ -221,6 +222,7 @@ multi method stream-xml(PDF::Tags::Elem $node, UInt :$depth is copy = 0) { atts-str(%attributes); } // ''; $name = $_ with $role; + return if $name eq 'Artifact' && !$!artifacts; my $omit-tag = $name ~~ $_ with $!omit; if $depth >= $!max-depth {