mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[Editor] Add the ability to create/update the structure tree when saving a pdf containing newly added annotations (bug 1845087)
When there is no tree, the tags for the new annotions are just put under the root element. When there is a tree, we insert the new tags at the right place in using the value of structTreeParentId (added in PR #16916).
This commit is contained in:
parent
7f8de83e96
commit
a8573d4e1b
8 changed files with 613 additions and 14 deletions
|
@ -32,6 +32,8 @@ async function writeObject(ref, obj, buffer, { encrypt = null }) {
|
|||
await writeDict(obj, buffer, transform);
|
||||
} else if (obj instanceof BaseStream) {
|
||||
await writeStream(obj, buffer, transform);
|
||||
} else if (Array.isArray(obj)) {
|
||||
await writeArray(obj, buffer, transform);
|
||||
}
|
||||
buffer.push("\nendobj\n");
|
||||
}
|
||||
|
@ -233,11 +235,7 @@ async function updateAcroform({
|
|||
return;
|
||||
}
|
||||
|
||||
// Clone the acroForm.
|
||||
const dict = new Dict(xref);
|
||||
for (const key of acroForm.getKeys()) {
|
||||
dict.set(key, acroForm.getRaw(key));
|
||||
}
|
||||
const dict = acroForm.clone();
|
||||
|
||||
if (hasXfa && !hasXfaDatasetsEntry) {
|
||||
// We've a XFA array which doesn't contain a datasets entry.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue