mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
[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:
parent
2a837ba0b5
commit
37bd78c707
19 changed files with 754 additions and 39 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue