XFA - Don't display images with a href
This commit is contained in:
parent
0df1a56619
commit
209ac5ca57
@ -2248,24 +2248,25 @@ class Image extends StringObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[$toHTML]() {
|
[$toHTML]() {
|
||||||
const html = {
|
if (this.href || !this[$content]) {
|
||||||
name: "img",
|
// TODO: href can be a Name refering to an internal stream
|
||||||
attributes: {
|
// containing a picture.
|
||||||
class: "xfaImage",
|
// In general, we don't get remote data and use what we have
|
||||||
style: {},
|
// in the pdf itself, so no picture for non null href.
|
||||||
},
|
return null;
|
||||||
};
|
|
||||||
|
|
||||||
if (this.href) {
|
|
||||||
html.attributes.src = new URL(this.href).href;
|
|
||||||
return html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.transferEncoding === "base64") {
|
if (this.transferEncoding === "base64") {
|
||||||
const buffer = stringToBytes(atob(this[$content]));
|
const buffer = stringToBytes(atob(this[$content]));
|
||||||
const blob = new Blob([buffer], { type: this.contentType });
|
const blob = new Blob([buffer], { type: this.contentType });
|
||||||
html.attributes.src = URL.createObjectURL(blob);
|
return {
|
||||||
return html;
|
name: "img",
|
||||||
|
attributes: {
|
||||||
|
class: "xfaImage",
|
||||||
|
style: {},
|
||||||
|
src: URL.createObjectURL(blob),
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user