[Editor] Add a basic stamp editor (bug 1790255)

For now it allows to add a stamp annotation with an image selected from the file system.
This commit is contained in:
Calixte Denizet 2023-06-22 12:16:07 +02:00
parent 2a837ba0b5
commit 37bd78c707
19 changed files with 754 additions and 39 deletions

View file

@ -1014,6 +1014,27 @@ function normalizeUnicode(str) {
});
}
function getUuid() {
if (
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) ||
(typeof crypto !== "undefined" && typeof crypto?.randomUUID === "function")
) {
return crypto.randomUUID();
}
const buf = new Uint8Array(32);
if (
typeof crypto !== "undefined" &&
typeof crypto?.getRandomValues === "function"
) {
crypto.getRandomValues(buf);
} else {
for (let i = 0; i < 32; i++) {
buf[i] = Math.floor(Math.random() * 255);
}
}
return bytesToString(buf);
}
export {
AbortException,
AnnotationActionEventType,
@ -1037,6 +1058,7 @@ export {
FONT_IDENTITY_MATRIX,
FormatError,
getModificationDate,
getUuid,
getVerbosityLevel,
IDENTITY_MATRIX,
ImageKind,