Skip to content

Commit 5c489f1

Browse files
authored
Array buffer fix/1994 (#1996)
* Create standard.spec.js * Update addimage.js * Delete standard.spec.js
1 parent c53beb6 commit 5c489f1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugins/addimage.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,16 @@
233233
, notDefined = function(value) {
234234
return typeof value === 'undefined' || value === null || value.length === 0;
235235
}
236-
, generateAliasFromData = function(data) {
237-
return typeof data === 'string' && jsPDFAPI.sHashCode(data);
236+
, generateAliasFromData = function(imageData) {
237+
if (typeof imageData === 'string') {
238+
return jsPDFAPI.sHashCode(imageData);
239+
}
240+
241+
if (jsPDFAPI.isArrayBufferView(imageData)) {
242+
return jsPDFAPI.sHashCode(jsPDFAPI.arrayBufferToBinaryString(imageData));
243+
}
244+
245+
return null;
238246
}
239247
, isImageTypeSupported = function(type) {
240248
return (typeof jsPDFAPI["process" + type.toUpperCase()] === "function");

0 commit comments

Comments
 (0)