mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Use the stringToBytes
helper function in more places
Rather than manually reimplementing, more-or-less, this functionality in a few spots we can simply use the existing helper function instead.
This commit is contained in:
parent
b2ffebe978
commit
53a70244d0
2 changed files with 6 additions and 8 deletions
|
@ -57,7 +57,7 @@ import {
|
|||
getRelevant,
|
||||
getStringOption,
|
||||
} from "./utils.js";
|
||||
import { Util, warn } from "../../shared/util.js";
|
||||
import { stringToBytes, Util, warn } from "../../shared/util.js";
|
||||
|
||||
const TEMPLATE_NS_ID = NamespaceIds.template.id;
|
||||
|
||||
|
@ -2262,9 +2262,7 @@ class Image extends StringObject {
|
|||
}
|
||||
|
||||
if (this.transferEncoding === "base64") {
|
||||
const buffer = Uint8Array.from(atob(this[$content]), c =>
|
||||
c.charCodeAt(0)
|
||||
);
|
||||
const buffer = stringToBytes(atob(this[$content]));
|
||||
const blob = new Blob([buffer], { type: this.contentType });
|
||||
html.attributes.src = URL.createObjectURL(blob);
|
||||
return html;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue