Skip to content

Commit eef9e92

Browse files
committed
Relax StructElem /P entry requirement
Some Canva PDF StructElem objects are missing this. But are otherwise able to be processed.
1 parent 3d8fc4a commit eef9e92

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/PDF/StructElem.rakumod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ multi sub coerce-child($_, StructElemChild) {
6161
warn "Unable to coerce {.raku} to a PDF::StructElem.K (child) element";
6262
}
6363

64-
has StructElemParent $.P is entry(:required, :alias<struct-parent>, :coerce(&coerce-parent)); # (Required; shall be an indirect reference) The structure element that is the immediate parent of this one in the structure hierarchy.
64+
has StructElemParent $.P is entry(:alias<struct-parent>, :coerce(&coerce-parent)); # (Required; shall be an indirect reference) The structure element that is the immediate parent of this one in the structure hierarchy.
6565
has StructElemChild @.K is entry(:array-or-item, :alias<kids>, :coerce(&coerce-child)); # (Optional) The children of this structure element. The value of this entry may be one of the following objects or an array consisting of one or more of the following objects:
6666
# • A structure element dictionary denoting another structure element
6767
# • An integer marked-content identifier denoting a marked-content sequence
@@ -160,3 +160,7 @@ my subset PhoneticAlphabet of PDF::COS::Name where 'ipa'|'x-sampa'|'zh-Latn-piny
160160
has PhoneticAlphabet $.PhoneticAlphabet is entry; # (Optional; PDF 2.0) Property for a structure element that indicates the phonetic alphabet used by a Phoneme property. Applies to the structure element and its children, except where overridden by a child structure element.
161161

162162
has PDF::COS::TextString $.Phoneme is entry; # (Optional; PDF 2.0) Property for a structure element that may be used as pronunciation hint. It is an exact replacement for content enclosed by the structure element and its children.
163+
164+
method cb-check {
165+
die "missing required field /P" without self.P;
166+
}

0 commit comments

Comments
 (0)