Skip to content

Commit

Permalink
Extends the page dict instead of overwriting it
Browse files Browse the repository at this point in the history
  • Loading branch information
nubis committed Apr 29, 2023
1 parent dce6806 commit 1989471
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
30 changes: 30 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fn main() {
("Subtype", Object::Name(b"Link".to_vec())),
("Rect", vec![20.into(), 580.into(), 300.into(), 560.into()].into()),
("C", vec![].into()),
("Contents", Object::String("Hello ñandu".into(), Literal)),
("Contents", Object::String("Hello World".into(), Literal)),
("A", action.into()),
]);

Expand Down
6 changes: 4 additions & 2 deletions src/pdf_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,10 @@ impl PdfDocumentReference {
("Parent", Reference(pages_id)),
]);

if let Some(extended) = &page.extend_with {
p.extend(&extended)
if let Some(extension) = &page.extend_with {
for (key, value) in extension.iter() {
p.set(key.to_vec(), value.clone())
}
}

// this will collect the resources needed for rendering this page
Expand Down

0 comments on commit 1989471

Please sign in to comment.