mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
[Editor] Add support for printing newly added Ink annotations
This commit is contained in:
parent
8d466f5dac
commit
f27c8c4471
6 changed files with 271 additions and 94 deletions
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
AnnotationEditorPrefix,
|
||||
assert,
|
||||
BaseException,
|
||||
FontType,
|
||||
|
@ -548,6 +549,27 @@ function numberToString(value) {
|
|||
return value.toFixed(2);
|
||||
}
|
||||
|
||||
function getNewAnnotationsMap(annotationStorage) {
|
||||
if (!annotationStorage) {
|
||||
return null;
|
||||
}
|
||||
const newAnnotationsByPage = new Map();
|
||||
// The concept of page in a XFA is very different, so
|
||||
// editing is just not implemented.
|
||||
for (const [key, value] of annotationStorage) {
|
||||
if (!key.startsWith(AnnotationEditorPrefix)) {
|
||||
continue;
|
||||
}
|
||||
let annotations = newAnnotationsByPage.get(value.pageIndex);
|
||||
if (!annotations) {
|
||||
annotations = [];
|
||||
newAnnotationsByPage.set(value.pageIndex, annotations);
|
||||
}
|
||||
annotations.push(value);
|
||||
}
|
||||
return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
|
||||
}
|
||||
|
||||
export {
|
||||
collectActions,
|
||||
DocStats,
|
||||
|
@ -556,6 +578,7 @@ export {
|
|||
getArrayLookupTableFactory,
|
||||
getInheritableProperty,
|
||||
getLookupTableFactory,
|
||||
getNewAnnotationsMap,
|
||||
isWhiteSpace,
|
||||
log2,
|
||||
MissingDataException,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue