Fix for images in Firefox

This commit is contained in:
Hillel Coren 2016-08-09 15:22:33 +03:00
parent 713394ea8a
commit fa88c74d23
8 changed files with 111 additions and 85 deletions

View File

@ -83,11 +83,12 @@ elixir(function(mix) {
*/ */
mix.scripts(['resources/assets/js/Chart.js'], 'public/js/Chart.min.js') mix.scripts(['resources/assets/js/Chart.js'], 'public/js/Chart.min.js')
.scripts(['resources/assets/js/d3.js'], 'public/js/d3.min.js'); .scripts(['resources/assets/js/d3.js'], 'public/js/d3.min.js');
mix.scripts([ mix.scripts([
'public/js/pdf_viewer.js', 'public/js/pdf_viewer.js',
'public/js/compatibility.js', 'public/js/compatibility.js',
'public/js/pdfmake.min.js', //'public/js/pdfmake.min.js',
'public/js/pdfmake.js',
'public/js/vfs.js' 'public/js/vfs.js'
], 'public/pdf.built.js'); ], 'public/pdf.built.js');

19
public/css/built.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3001,11 +3001,11 @@
if(!curGroup || deco !== curGroup.decoration || if(!curGroup || deco !== curGroup.decoration ||
style !== curGroup.decorationStyle || color !== curGroup.decorationColor || style !== curGroup.decorationStyle || color !== curGroup.decorationColor ||
deco === 'lineThrough') { deco === 'lineThrough') {
curGroup = { curGroup = {
line: line, line: line,
decoration: deco, decoration: deco,
decorationColor: color, decorationColor: color,
decorationStyle: style, decorationStyle: style,
inlines: [ inline ] inlines: [ inline ]
}; };
@ -3015,7 +3015,7 @@
} }
} }
} }
return groups; return groups;
} }
@ -3042,9 +3042,9 @@
ascent = biggerInline.font.ascender / 1000 * biggerInline.fontSize, ascent = biggerInline.font.ascender / 1000 * biggerInline.fontSize,
height = biggerInline.height, height = biggerInline.height,
descent = height - ascent; descent = height - ascent;
var lw = 0.5 + Math.floor(Math.max(biggerInline.fontSize - 8, 0) / 2) * 0.12; var lw = 0.5 + Math.floor(Math.max(biggerInline.fontSize - 8, 0) / 2) * 0.12;
switch (group.decoration) { switch (group.decoration) {
case 'underline': case 'underline':
y += lineAscent + descent * 0.45; y += lineAscent + descent * 0.45;
@ -3059,7 +3059,7 @@
throw 'Unkown decoration : ' + group.decoration; throw 'Unkown decoration : ' + group.decoration;
} }
pdfKitDoc.save(); pdfKitDoc.save();
if(group.decorationStyle === 'double') { if(group.decorationStyle === 'double') {
var gap = Math.max(0.5, lw*2); var gap = Math.max(0.5, lw*2);
pdfKitDoc .fillColor(group.decorationColor) pdfKitDoc .fillColor(group.decorationColor)
@ -3096,7 +3096,7 @@
rwx += sh*6; rwx += sh*6;
} }
pdfKitDoc.stroke(group.decorationColor); pdfKitDoc.stroke(group.decorationColor);
} else { } else {
pdfKitDoc .fillColor(group.decorationColor) pdfKitDoc .fillColor(group.decorationColor)
.rect(x + firstInline.x, y-lw/2, totalWidth, lw) .rect(x + firstInline.x, y-lw/2, totalWidth, lw)
@ -14510,7 +14510,7 @@
margin = convertMargin(flattenedStyleArray.margin); margin = convertMargin(flattenedStyleArray.margin);
} }
} }
margin = processSingleMargins(node, margin); margin = processSingleMargins(node, margin);
if(node.margin){ if(node.margin){
@ -15218,9 +15218,9 @@
}; };
PageElementWriter.prototype.moveToNextPage = function(pageOrientation) { PageElementWriter.prototype.moveToNextPage = function(pageOrientation) {
var nextPage = this.writer.context.moveToNextPage(pageOrientation); var nextPage = this.writer.context.moveToNextPage(pageOrientation);
if (nextPage.newPageCreated) { if (nextPage.newPageCreated) {
this.repeatables.forEach(function(rep) { this.repeatables.forEach(function(rep) {
this.writer.addFragment(rep, true); this.writer.addFragment(rep, true);
@ -16690,7 +16690,7 @@
/* 30 */ /* 30 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
* isArray * isArray
*/ */
@ -17664,7 +17664,7 @@
// modules, so it is better not to alter this value unless you know what // modules, so it is better not to alter this value unless you know what
// you're doing. // you're doing.
function buildCanvas(data, options) { function buildCanvas(data, options) {
var canvas = []; var canvas = [];
var background = data.background || '#fff'; var background = data.background || '#fff';
var foreground = data.foreground || '#000'; var foreground = data.foreground || '#000';
@ -17673,12 +17673,12 @@
var n = matrix.length; var n = matrix.length;
var modSize = Math.floor( options.fit ? options.fit/n : 5 ); var modSize = Math.floor( options.fit ? options.fit/n : 5 );
var size = n * modSize; var size = n * modSize;
canvas.push({ canvas.push({
type: 'rect', type: 'rect',
x: 0, y: 0, w: size, h: size, lineWidth: 0, color: background x: 0, y: 0, w: size, h: size, lineWidth: 0, color: background
}); });
for (var i = 0; i < n; ++i) { for (var i = 0; i < n; ++i) {
for (var j = 0; j < n; ++j) { for (var j = 0; j < n; ++j) {
if(matrix[i][j]) { if(matrix[i][j]) {
@ -17694,12 +17694,12 @@
} }
} }
} }
return { return {
canvas: canvas, canvas: canvas,
size: size size: size
}; };
} }
function measure(node) { function measure(node) {
@ -19734,7 +19734,7 @@
this._fontSize = 12; this._fontSize = 12;
this._font = null; this._font = null;
this._registeredFonts = {}; this._registeredFonts = {};
}, },
font: function(src, family, size) { font: function(src, family, size) {
var cacheKey, font, id, _ref; var cacheKey, font, id, _ref;
@ -21435,7 +21435,7 @@
function Zlib(mode) { function Zlib(mode) {
if (mode < exports.DEFLATE || mode > exports.UNZIP) if (mode < exports.DEFLATE || mode > exports.UNZIP)
throw new TypeError("Bad argument"); throw new TypeError("Bad argument");
this.mode = mode; this.mode = mode;
this.init_done = false; this.init_done = false;
this.write_in_progress = false; this.write_in_progress = false;
@ -21453,18 +21453,18 @@
this.memLevel = memLevel; this.memLevel = memLevel;
this.strategy = strategy; this.strategy = strategy;
// dictionary not supported. // dictionary not supported.
if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) if (this.mode === exports.GZIP || this.mode === exports.GUNZIP)
this.windowBits += 16; this.windowBits += 16;
if (this.mode === exports.UNZIP) if (this.mode === exports.UNZIP)
this.windowBits += 32; this.windowBits += 32;
if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW)
this.windowBits = -this.windowBits; this.windowBits = -this.windowBits;
this.strm = new zstream(); this.strm = new zstream();
switch (this.mode) { switch (this.mode) {
case exports.DEFLATE: case exports.DEFLATE:
case exports.GZIP: case exports.GZIP:
@ -21490,12 +21490,12 @@
default: default:
throw new Error("Unknown mode " + this.mode); throw new Error("Unknown mode " + this.mode);
} }
if (status !== exports.Z_OK) { if (status !== exports.Z_OK) {
this._error(status); this._error(status);
return; return;
} }
this.write_in_progress = false; this.write_in_progress = false;
this.init_done = true; this.init_done = true;
}; };
@ -21507,31 +21507,31 @@
Zlib.prototype._writeCheck = function() { Zlib.prototype._writeCheck = function() {
if (!this.init_done) if (!this.init_done)
throw new Error("write before init"); throw new Error("write before init");
if (this.mode === exports.NONE) if (this.mode === exports.NONE)
throw new Error("already finalized"); throw new Error("already finalized");
if (this.write_in_progress) if (this.write_in_progress)
throw new Error("write already in progress"); throw new Error("write already in progress");
if (this.pending_close) if (this.pending_close)
throw new Error("close is pending"); throw new Error("close is pending");
}; };
Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) { Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) {
this._writeCheck(); this._writeCheck();
this.write_in_progress = true; this.write_in_progress = true;
var self = this; var self = this;
process.nextTick(function() { process.nextTick(function() {
self.write_in_progress = false; self.write_in_progress = false;
var res = self._write(flush, input, in_off, in_len, out, out_off, out_len); var res = self._write(flush, input, in_off, in_len, out, out_off, out_len);
self.callback(res[0], res[1]); self.callback(res[0], res[1]);
if (self.pending_close) if (self.pending_close)
self.close(); self.close();
}); });
return this; return this;
}; };
@ -21549,7 +21549,7 @@
Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) { Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) {
this.write_in_progress = true; this.write_in_progress = true;
if (flush !== exports.Z_NO_FLUSH && if (flush !== exports.Z_NO_FLUSH &&
flush !== exports.Z_PARTIAL_FLUSH && flush !== exports.Z_PARTIAL_FLUSH &&
flush !== exports.Z_SYNC_FLUSH && flush !== exports.Z_SYNC_FLUSH &&
@ -21558,18 +21558,18 @@
flush !== exports.Z_BLOCK) { flush !== exports.Z_BLOCK) {
throw new Error("Invalid flush value"); throw new Error("Invalid flush value");
} }
if (input == null) { if (input == null) {
input = new Buffer(0); input = new Buffer(0);
in_len = 0; in_len = 0;
in_off = 0; in_off = 0;
} }
if (out._set) if (out._set)
out.set = out._set; out.set = out._set;
else else
out.set = bufferSet; out.set = bufferSet;
var strm = this.strm; var strm = this.strm;
strm.avail_in = in_len; strm.avail_in = in_len;
strm.input = input; strm.input = input;
@ -21577,7 +21577,7 @@
strm.avail_out = out_len; strm.avail_out = out_len;
strm.output = out; strm.output = out;
strm.next_out = out_off; strm.next_out = out_off;
switch (this.mode) { switch (this.mode) {
case exports.DEFLATE: case exports.DEFLATE:
case exports.GZIP: case exports.GZIP:
@ -21593,11 +21593,11 @@
default: default:
throw new Error("Unknown mode " + this.mode); throw new Error("Unknown mode " + this.mode);
} }
if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) { if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) {
this._error(status); this._error(status);
} }
this.write_in_progress = false; this.write_in_progress = false;
return [strm.avail_in, strm.avail_out]; return [strm.avail_in, strm.avail_out];
}; };
@ -21607,15 +21607,15 @@
this.pending_close = true; this.pending_close = true;
return; return;
} }
this.pending_close = false; this.pending_close = false;
if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) {
zlib_deflate.deflateEnd(this.strm); zlib_deflate.deflateEnd(this.strm);
} else { } else {
zlib_inflate.inflateEnd(this.strm); zlib_inflate.inflateEnd(this.strm);
} }
this.mode = exports.NONE; this.mode = exports.NONE;
}; };
@ -21630,7 +21630,7 @@
var status = zlib_inflate.inflateReset(this.strm); var status = zlib_inflate.inflateReset(this.strm);
break; break;
} }
if (status !== exports.Z_OK) { if (status !== exports.Z_OK) {
this._error(status); this._error(status);
} }
@ -21638,7 +21638,7 @@
Zlib.prototype._error = function(status) { Zlib.prototype._error = function(status) {
this.onerror(msg[status] + ': ' + this.strm.msg, status); this.onerror(msg[status] + ': ' + this.strm.msg, status);
this.write_in_progress = false; this.write_in_progress = false;
if (this.pending_close) if (this.pending_close)
this.close(); this.close();
@ -21657,20 +21657,20 @@
/* /*
# MIT LICENSE # MIT LICENSE
# Copyright (c) 2011 Devon Govett # Copyright (c) 2011 Devon Govett
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy of this # Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software # software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify, merge, # without restriction, including without limitation the rights to use, copy, modify, merge,
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons # publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
# to whom the Software is furnished to do so, subject to the following conditions: # to whom the Software is furnished to do so, subject to the following conditions:
# #
# The above copyright notice and this permission notice shall be included in all copies or # The above copyright notice and this permission notice shall be included in all copies or
# substantial portions of the Software. # substantial portions of the Software.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
# BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/ */
@ -30781,12 +30781,12 @@
* An implementation of Ruby's string.succ method. * An implementation of Ruby's string.succ method.
* By Devon Govett * By Devon Govett
* *
* Returns the successor to str. The successor is calculated by incrementing characters starting * Returns the successor to str. The successor is calculated by incrementing characters starting
* from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the * from the rightmost alphanumeric (or the rightmost character if there are no alphanumerics) in the
* string. Incrementing a digit always results in another digit, and incrementing a letter results in * string. Incrementing a digit always results in another digit, and incrementing a letter results in
* another letter of the same case. * another letter of the same case.
* *
* If the increment generates a carry, the character to the left of it is incremented. This * If the increment generates a carry, the character to the left of it is incremented. This
* process repeats until there is no carry, adding an additional character if necessary. * process repeats until there is no carry, adding an additional character if necessary.
* *
* succ("abcd") == "abce" * succ("abcd") == "abce"
@ -32501,10 +32501,11 @@
var fnTyped = { var fnTyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) { arraySet: function (dest, src, src_offs, len, dest_offs) {
if (src.subarray && dest.subarray) { // https://github.com/bpampuch/pdfmake/issues/577#issuecomment-238223949
dest.set(src.subarray(src_offs, src_offs+len), dest_offs); //if (src.subarray && dest.subarray) {
return; // dest.set(src.subarray(src_offs, src_offs+len), dest_offs);
} // return;
//}
// Fallback to ordinary array // Fallback to ordinary array
for(var i=0; i<len; i++) { for(var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i]; dest[dest_offs + i] = src[src_offs + i];
@ -66365,4 +66366,4 @@
/***/ } /***/ }
/******/ ]); /******/ ]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long