mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
[Editor] Avoid conflicts between new persistent refs and the ones created when saving (bug 1865341)
When a pdf as a FreeText without appearance, we use a fake font in order to render it and that leads to create few new refs for the font. But then when we're saving, we create some new refs which start at the same number as the previous created ones. Consequently, when saving we're using some wrong objects (like a font) to check if we're able to render the newly added FreeText. In order to fix this bug, we just remove the persistent refs (which are only used when rendering/printing) during the saving.
This commit is contained in:
parent
795c63e400
commit
ae5828c968
6 changed files with 52 additions and 0 deletions
|
@ -656,6 +656,12 @@ class Driver {
|
|||
if (!task.annotationStorage) {
|
||||
throw new Error("Missing `annotationStorage` entry.");
|
||||
}
|
||||
if (task.loadAnnotations) {
|
||||
for (let num = 1; num <= doc.numPages; num++) {
|
||||
const page = await doc.getPage(num);
|
||||
await page.getAnnotations({ intent: "display" });
|
||||
}
|
||||
}
|
||||
doc.annotationStorage.setAll(task.annotationStorage);
|
||||
|
||||
const data = await doc.saveDocument();
|
||||
|
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
|
@ -619,3 +619,4 @@
|
|||
!issue17069.pdf
|
||||
!issue17215.pdf
|
||||
!bug1863910.pdf
|
||||
!bug1865341.pdf
|
||||
|
|
BIN
test/pdfs/bug1865341.pdf
Executable file
BIN
test/pdfs/bug1865341.pdf
Executable file
Binary file not shown.
|
@ -8381,5 +8381,26 @@
|
|||
"link": true,
|
||||
"type": "eq",
|
||||
"annotations": true
|
||||
},
|
||||
{
|
||||
"id": "bug1865341",
|
||||
"file": "pdfs/bug1865341.pdf",
|
||||
"md5": "e241b6d1dc493df73e77e3eeabc71721",
|
||||
"rounds": 1,
|
||||
"type": "eq",
|
||||
"save": true,
|
||||
"print": true,
|
||||
"loadAnnotations": true,
|
||||
"annotationStorage": {
|
||||
"pdfjs_internal_editor_0": {
|
||||
"annotationType": 3,
|
||||
"color": [255, 0, 0],
|
||||
"fontSize": 10,
|
||||
"value": "Załącznik",
|
||||
"pageIndex": 0,
|
||||
"rect": [ 238, 629, 287, 649],
|
||||
"rotation": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue