Skip to content

Commit 0811ebf

Browse files
saeckireknih
authored andcommitted
fix: RoleMapNs entries should be arrays instead of dicts
1 parent f9cde6a commit 0811ebf

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

src/structure.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,10 +1585,10 @@ impl NamespaceRoleMap<'_> {
15851585
/// namespace referenced by the namespace dictionary the value of the
15861586
/// `ns_ref` parameter points to.
15871587
pub fn to_namespace(&mut self, name: Name, role: Name, ns_ref: Ref) -> &mut Self {
1588-
let mut dict = self.dict.insert(name).dict();
1589-
dict.pair(Name(b"Role"), role);
1590-
dict.pair(Name(b"NS"), ns_ref);
1591-
dict.finish();
1588+
let mut array = self.dict.insert(name).array();
1589+
array.item(role);
1590+
array.item(ns_ref);
1591+
array.finish();
15921592
self
15931593
}
15941594

@@ -1604,11 +1604,7 @@ impl NamespaceRoleMap<'_> {
16041604
role: StructRole2,
16051605
pdf_2_ns: Ref,
16061606
) -> &mut Self {
1607-
let mut dict = self.dict.insert(name).dict();
1608-
dict.pair(Name(b"Role"), role.to_name(&mut [0; 6]));
1609-
dict.pair(Name(b"NS"), pdf_2_ns);
1610-
dict.finish();
1611-
self
1607+
self.to_namespace(name, role.to_name(&mut [0; 6]), pdf_2_ns)
16121608
}
16131609
}
16141610

0 commit comments

Comments
 (0)