mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 16:48:08 +02:00
Introduce some Uint8Array.fromBase64
and Uint8Array.prototype.toBase64
usage in the main code-base
See https://github.com/tc39/proposal-arraybuffer-base64
This commit is contained in:
parent
f9fc477080
commit
bfc645bab1
2 changed files with 3 additions and 5 deletions
|
@ -102,7 +102,7 @@ import {
|
|||
getStringOption,
|
||||
HTMLResult,
|
||||
} from "./utils.js";
|
||||
import { stringToBytes, Util, warn } from "../../shared/util.js";
|
||||
import { Util, warn } from "../../shared/util.js";
|
||||
import { getMetrics } from "./fonts.js";
|
||||
import { recoverJsURL } from "../core_utils.js";
|
||||
import { searchNode } from "./som.js";
|
||||
|
@ -3427,7 +3427,7 @@ class Image extends StringObject {
|
|||
}
|
||||
|
||||
if (!buffer && this.transferEncoding === "base64") {
|
||||
buffer = stringToBytes(atob(this[$content]));
|
||||
buffer = Uint8Array.fromBase64(this[$content]);
|
||||
}
|
||||
|
||||
if (!buffer) {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
import {
|
||||
assert,
|
||||
bytesToString,
|
||||
FontRenderOps,
|
||||
isNodeJS,
|
||||
shadow,
|
||||
|
@ -399,9 +398,8 @@ class FontFaceObject {
|
|||
if (!this.data || this.disableFontFace) {
|
||||
return null;
|
||||
}
|
||||
const data = bytesToString(this.data);
|
||||
// Add the @font-face rule to the document.
|
||||
const url = `url(data:${this.mimetype};base64,${btoa(data)});`;
|
||||
const url = `url(data:${this.mimetype};base64,${this.data.toBase64()});`;
|
||||
let rule;
|
||||
if (!this.cssFontInfo) {
|
||||
rule = `@font-face {font-family:"${this.loadedName}";src:${url}}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue