PageSourceSearch

https://mail.jdz.gov.cn/javascript/print.js?v=1789635370868

js jdz.gov.cn collected 2026-10-02 07:41:25 UTC 39,837 bytes, 1,216 lines download raw bytes

vendor: 4,061 bytes, lines 1-98
1(function webpackUniversalModuleDefinition(root, factory) {
2	if(typeof exports === 'object' && typeof module === 'object')
3		module.exports = factory();
4	else if(typeof define === 'function' && define.amd)
5		define([], factory);
6	else if(typeof exports === 'object')
7		exports["printJS"] = factory();
8	else
9		root["printJS"] = factory();
10})(window, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ 	// The module cache
13/******/ 	var installedModules = {};
14/******/
15/******/ 	// The require function
16/******/ 	function __webpack_require__(moduleId) {
17/******/
18/******/ 		// Check if module is in cache
19/******/ 		if(installedModules[moduleId]) {
20/******/ 			return installedModules[moduleId].exports;
21/******/ 		}
22/******/ 		// Create a new module (and put it into the cache)
23/******/ 		var module = installedModules[moduleId] = {
24/******/ 			i: moduleId,
25/******/ 			l: false,
26/******/ 			exports: {}
27/******/ 		};
28/******/
29/******/ 		// Execute the module function
30/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ 		// Flag the module as loaded
33/******/ 		module.l = true;
34/******/
35/******/ 		// Return the exports of the module
36/******/ 		return module.exports;
37/******/ 	}
38/******/
39/******/
40/******/ 	// expose the modules object (__webpack_modules__)
41/******/ 	__webpack_require__.m = modules;
42/******/
43/******/ 	// expose the module cache
44/******/ 	__webpack_require__.c = installedModules;
45/******/
46/******/ 	// define getter function for harmony exports
47/******/ 	__webpack_require__.d = function(exports, name, getter) {
48/******/ 		if(!__webpack_require__.o(exports, name)) {
49/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
50/******/ 		}
51/******/ 	};
52/******/
53/******/ 	// define __esModule on exports
54/******/ 	__webpack_require__.r = function(exports) {
55/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
56/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
57/******/ 		}
58/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
59/******/ 	};
60/******/
61/******/ 	// create a fake namespace object
62/******/ 	// mode & 1: value is a module id, require it
63/******/ 	// mode & 2: merge all properties of value into the ns
64/******/ 	// mode & 4: return value when already ns object
65/******/ 	// mode & 8|1: behave like require
66/******/ 	__webpack_require__.t = function(value, mode) {
67/******/ 		if(mode & 1) value = __webpack_require__(value);
68/******/ 		if(mode & 8) return value;
69/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
70/******/ 		var ns = Object.create(null);
71/******/ 		__webpack_require__.r(ns);
72/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
73/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
74/******/ 		return ns;
75/******/ 	};
76/******/
77/******/ 	// getDefaultExport function for compatibility with non-harmony modules
78/******/ 	__webpack_require__.n = function(module) {
79/******/ 		var getter = module && module.__esModule ?
80/******/ 			function getDefault() { return module['default']; } :
81/******/ 			function getModuleExports() { return module; };
82/******/ 		__webpack_require__.d(getter, 'a', getter);
83/******/ 		return getter;
84/******/ 	};
85/******/
86/******/ 	// Object.prototype.hasOwnProperty.call
87/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
88/******/
89/******/ 	// __webpack_public_path__
90/******/ 	__webpack_require__.p = "";
91/******/
92/******/
93/******/ 	// Load entry module and return exports
94/******/ 	return __webpack_require__(__webpack_require__.s = 0);
95/******/ })
96/************************************************************************/
97/******/ ({
98
99/***/ "./src/index.js":
100/*!**********************!*\
101  !*** ./src/index.js ***!
102  \**********************/
103/*! no static exports found */
104/***/ (function(module, exports, __webpack_require__) {
105
106"use strict";
107
108
109Object.defineProperty(exports, "__esModule", {
110  value: true
111});
112
113__webpack_require__(/*! ./sass/index.scss */ "./src/sass/index.scss");
114
115var _init = __webpack_require__(/*! ./js/init */ "./src/js/init.js");
116
117var _init2 = _interopRequireDefault(_init);
118
119function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
120
121var printJS = _init2.default.init;
122
123if (typeof window !== 'undefined') {
124  window.printJS = printJS;
125}
126
127exports.default = printJS;
128
129/***/ }),
130
vendor: 1,174 bytes, lines 131-172
131/***/ "./src/js/browser.js":
132/*!***************************!*\
133  !*** ./src/js/browser.js ***!
134  \***************************/
135/*! no static exports found */
136/***/ (function(module, exports, __webpack_require__) {
137
138"use strict";
139
140
141Object.defineProperty(exports, "__esModule", {
142  value: true
143});
144var Browser = {
145  // Firefox 1.0+
146  isFirefox: function isFirefox() {
147    return typeof InstallTrigger !== 'undefined';
148  },
149  // Internet Explorer 6-11
150  isIE: function isIE() {
151    return navigator.userAgent.indexOf('MSIE') !== -1 || !!document.documentMode;
152  },
153  // Edge 20+
154  isEdge: function isEdge() {
155    return !Browser.isIE() && !!window.StyleMedia;
156  },
157  // Chrome 1+
158  isChrome: function isChrome() {
159    var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
160
161    return !!context.chrome;
162  },
163  // At least Safari 3+: "[object HTMLElementConstructor]"
164  isSafari: function isSafari() {
165    return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 || navigator.userAgent.toLowerCase().indexOf('safari') !== -1;
166  }
167};
168
169exports.default = Browser;
170
171/***/ }),
172
173/***/ "./src/js/functions.js":
174/*!*****************************!*\
175  !*** ./src/js/functions.js ***!
176  \*****************************/
177/*! no static exports found */
178/***/ (function(module, exports, __webpack_require__) {
179
180"use strict";
181
182
183Object.defineProperty(exports, "__esModule", {
184  value: true
185});
186
187var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
188
189exports.addWrapper = addWrapper;
190exports.capitalizePrint = capitalizePrint;
191exports.collectStyles = collectStyles;
192exports.loopNodesCollectStyles = loopNodesCollectStyles;
193exports.addHeader = addHeader;
194exports.cleanUp = cleanUp;
195exports.isRawHTML = isRawHTML;
196
197var _modal = __webpack_require__(/*! ./modal */ "./src/js/modal.js");
198
199var _modal2 = _interopRequireDefault(_modal);
200
201var _browser = __webpack_require__(/*! ./browser */ "./src/js/browser.js");
202
203var _browser2 = _interopRequireDefault(_browser);
204
205function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
206
207function addWrapper(htmlData, params) {
208  var bodyStyle = 'font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;';
209  return '<div style="' + bodyStyle + '">' + htmlData + '</div>';
210}
211
212function capitalizePrint(obj) {
213  return obj.charAt(0).toUpperCase() + obj.slice(1);
214}
215
216function collectStyles(element, params) {
217  var win = document.defaultView || window;
218
219  // String variable to hold styling for each element
220  var elementStyle = '';
221
222  // Loop over computed styles
223  var styles = win.getComputedStyle(element, '');
224
225  Object.keys(styles).map(function (key) {
226    // Check if style should be processed
227    if (params.targetStyles.indexOf('*') !== -1 || params.targetStyle.indexOf(styles[key]) !== -1 || targetStylesMatch(params.targetStyles, styles[key])) {
228      if (styles.getPropertyValue(styles[key])) elementStyle += styles[key] + ':' + styles.getPropertyValue(styles[key]) + ';';
229    }
230  });
231
232  // Print friendly defaults
233  elementStyle += 'max-width: ' + params.maxWidth + 'px !important;' + params.font_size + ' !important;';
234
235  return elementStyle;
236}
237
238function targetStylesMatch(styles, value) {
239  for (var i = 0; i < styles.length; i++) {
240    if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.indexOf(styles[i]) !== -1) return true;
241  }
242  return false;
243}
244
245function loopNodesCollectStyles(elements, params) {
246  for (var n = 0; n < elements.length; n++) {
247    var currentElement = elements[n];
248
249    // Check if we are skiping this element
250    if (params.ignoreElements.indexOf(currentElement.getAttribute('id')) !== -1) {
251      currentElement.parentNode.removeChild(currentElement);
252      continue;
253    }
254
255    // Form Printing - check if is element Input
256    var tag = currentElement.tagName;
257    if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') {
258      // Save style to variable
259      var textStyle = collectStyles(currentElement, params);
260
261      // Remove INPUT element and insert a text node
262      var parent = currentElement.parentNode;
263
264      // Get text value
265      var textNode = tag === 'SELECT' ? document.createTextNode(currentElement.options[currentElement.selectedIndex].text) : document.createTextNode(currentElement.value);
266
267      // Create text element
268      var textElement = document.createElement('div');
269      textElement.appendChild(textNode);
270
271      // Add style to text
272      textElement.setAttribute('style', textStyle);
273
274      // Add text
275      parent.appendChild(textElement);
276
277      // Remove input
278      parent.removeChild(currentElement);
279    } else {
280      // Get all styling for print element
281      currentElement.setAttribute('style', collectStyles(currentElement, params));
282    }
283
284    // Check if we have more elements in the tree
285    var children = currentElement.children;
286
287    if (children && children.length) {
288      loopNodesCollectStyles(children, params);
289    }
290  }
291}
292
293function addHeader(printElement, params) {
294  // Create the header container div
295  var headerContainer = document.createElement('div');
296
297  // Check if the header is text or raw html
298  if (isRawHTML(params.header)) {
299    headerContainer.innerHTML = params.header;
300  } else {
301    // Create header element
302    var headerElement = document.createElement('h1');
303
304    // Create header text node
305    var headerNode = document.createTextNode(params.header);
306
307    // Build and style
308    headerElement.appendChild(headerNode);
309    headerElement.setAttribute('style', params.headerStyle);
310    headerContainer.appendChild(headerElement);
311  }
312
313  printElement.insertBefore(headerContainer, printElement.childNodes[0]);
314}
315
316function cleanUp(params) {
317  // If we are showing a feedback message to user, remove it
318  if (params.showModal) _modal2.default.close();
319
320  // Check for a finished loading hook function
321  if (params.onLoadingEnd) params.onLoadingEnd();
322
323  // If preloading pdf files, clean blob url
324  if (params.showModal || params.onLoadingStart) window.URL.revokeObjectURL(params.printable);
325
326  // If a onPrintDialogClose callback is given, execute it
327  if (params.onPrintDialogClose) {
328    var event = 'mouseover';
329
330    if (_browser2.default.isChrome() || _browser2.default.isFirefox()) {
331      // Ps.: Firefox will require an extra click in the document to fire the focus event.
332      event = 'focus';
333    }
334    var handler = function handler() {
335      // Make sure the event only happens once.
336      window.removeEventListener(event, handler);
337
338      params.onPrintDialogClose();
339    };
340
341    window.addEventListener(event, handler);
342  }
343}
344
345function isRawHTML(raw) {
346  var regexHtml = new RegExp('<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>');
347  return regexHtml.test(raw);
348}
349
350/***/ }),
351
352/***/ "./src/js/html.js":
353/*!************************!*\
354  !*** ./src/js/html.js ***!
355  \************************/
356/*! no static exports found */
357/***/ (function(module, exports, __webpack_require__) {
358
359"use strict";
360
361
362Object.defineProperty(exports, "__esModule", {
363  value: true
364});
365
366var _functions = __webpack_require__(/*! ./functions */ "./src/js/functions.js");
367
368var _print = __webpack_require__(/*! ./print */ "./src/js/print.js");
369
370var _print2 = _interopRequireDefault(_print);
371
372function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
373
374exports.default = {
375  print: function print(params, printFrame) {
376    // Get the DOM printable element
377    var printElement = document.getElementById(params.printable);
378
379    // Check if the element exists
380    if (!printElement) {
381      window.console.error('Invalid HTML element id: ' + params.printable);
382      return;
383    }
384
385    // Clone the target element including its children (if available)
386    params.printableElement = cloneElement(printElement, params);
387    //增加水印
388    // 使用传递的单个水印数据对象生成多个随机位置的水印
389    if(params.watermark){
390        var watermarkHtml = '';
391        var numWatermarks = 12; // 生成的水印数量
392        var leftStart = -50; // 修改此处,从最左边开始的起始位置(百分比)
393        var leftEnd = 95; // 最右边的结束位置(百分比)
394        var topPositions = ['20%', '40%', '60%', '80%']; // 垂直方向的位置
395    
396        var step = (leftEnd - leftStart) / (numWatermarks - 1); // 计算步长
397    
398        for (var i = 0; i < numWatermarks; i++) {
399          var leftPosition = `${leftStart + i * step}%`;
400          var topPosition = topPositions[i % topPositions.length];
401          
402          watermarkHtml += `
403             <div class="watermark" style="top: ${topPosition}; left: ${leftPosition};">
404               <div class="watermark-content">
405                 <div> ${params.watermark.companyName}</div>
406                 <div> ${params.watermark.name}</div>
407               </div>
408             </div>
409           `;
410        }
411         //增加水印
412         params.printableElement.innerHTML += watermarkHtml;
413    }
414    // Add header
415    if (params.header) {
416      (0, _functions.addHeader)(params.printableElement, params);
417    }
418
419    // Print html element contents
420    _print2.default.send(params, printFrame);
421  }
422};
423
424
425function cloneElement(element, params) {
426  // Clone the main node (if not already inside the recursion process)
427  var clone = element.cloneNode();
428
429  // Loop over and process the children elements / nodes (including text nodes)
430  var _iteratorNormalCompletion = true;
431  var _didIteratorError = false;
432  var _iteratorError = undefined;
433
434  try {
435    for (var _iterator = element.childNodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
436      var child = _step.value;
437
438      // Check if we are skiping the current element
439      if (params.ignoreElements.indexOf(child.id) !== -1) {
440        continue;
441      }
442
443      // Clone the child element
444      var clonedChild = cloneElement(child, params);
445
446      // Attach the cloned child to the cloned parent node
447      clone.appendChild(clonedChild);
448    }
449
450    // Check if the element needs any state processing (copy user input data)
451  } catch (err) {
452    _didIteratorError = true;
453    _iteratorError = err;
454  } finally {
455    try {
456      if (!_iteratorNormalCompletion && _iterator.return) {
457        _iterator.return();
458      }
459    } finally {
460      if (_didIteratorError) {
461        throw _iteratorError;
462      }
463    }
464  }
465
466  switch (element.tagName) {
467    case 'SELECT':
468      // Copy the current selection value to its clone
469      clone.value = element.value;
470      break;
471    case 'CANVAS':
472      // Copy the canvas content to its clone
473      clone.getContext('2d').drawImage(element, 0, 0);
474      break;
475  }
476
477  return clone;
478}
479
480/***/ }),
481
482/***/ "./src/js/image.js":
483/*!*************************!*\
484  !*** ./src/js/image.js ***!
485  \*************************/
486/*! no static exports found */
487/***/ (function(module, exports, __webpack_require__) {
488
489"use strict";
490
491
492Object.defineProperty(exports, "__esModule", {
493  value: true
494});
495
496var _functions = __webpack_require__(/*! ./functions */ "./src/js/functions.js");
497
498var _print = __webpack_require__(/*! ./print */ "./src/js/print.js");
499
500var _print2 = _interopRequireDefault(_print);
501
502function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
503
504exports.default = {
505  print: function print(params, printFrame) {
506    // Check if we are printing one image or multiple images
507    if (params.printable.constructor !== Array) {
508      // Create array with one image
509      params.printable = [params.printable];
510    }
511
512    // Create printable element (container)
513    params.printableElement = document.createElement('div');
514
515    // Create all image elements and append them to the printable container
516    params.printable.forEach(function (src) {
517      // Create the image element
518      var img = document.createElement('img');
519      img.setAttribute('style', params.imageStyle);
520
521      // Set image src with the file url
522      img.src = src;
523
524      // Create the image wrapper
525      var imageWrapper = document.createElement('div');
526
527      // Append image to the wrapper element
528      imageWrapper.appendChild(img);
529
530      // Append wrapper to the printable element
531      params.printableElement.appendChild(imageWrapper);
532    });
533
534    // Check if we are adding a print header
535    if (params.header) (0, _functions.addHeader)(params.printableElement, params);
536
537    // Print image
538    _print2.default.send(params, printFrame);
539  }
540};
541
542/***/ }),
543
544/***/ "./src/js/init.js":
545/*!************************!*\
546  !*** ./src/js/init.js ***!
547  \************************/
548/*! no static exports found */
549/***/ (function(module, exports, __webpack_require__) {
550
551"use strict";
552
553
554Object.defineProperty(exports, "__esModule", {
555  value: true
556});
557
558var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
559
560var _browser = __webpack_require__(/*! ./browser */ "./src/js/browser.js");
561
562var _browser2 = _interopRequireDefault(_browser);
563
564var _modal = __webpack_require__(/*! ./modal */ "./src/js/modal.js");
565
566var _modal2 = _interopRequireDefault(_modal);
567
568var _pdf = __webpack_require__(/*! ./pdf */ "./src/js/pdf.js");
569
570var _pdf2 = _interopRequireDefault(_pdf);
571
572var _html = __webpack_require__(/*! ./html */ "./src/js/html.js");
573
574var _html2 = _interopRequireDefault(_html);
575
576var _rawHtml = __webpack_require__(/*! ./raw-html */ "./src/js/raw-html.js");
577
578var _rawHtml2 = _interopRequireDefault(_rawHtml);
579
580var _image = __webpack_require__(/*! ./image */ "./src/js/image.js");
581
582var _image2 = _interopRequireDefault(_image);
583
584var _json = __webpack_require__(/*! ./json */ "./src/js/json.js");
585
586var _json2 = _interopRequireDefault(_json);
587
588function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
589
590var printTypes = ['pdf', 'html', 'image', 'json', 'raw-html'];
591
592exports.default = {
593  init: function init() {
594    var params = {
595      printable: null,
596      fallbackPrintable: null,
597      type: 'pdf',
598      header: null,
599      headerStyle: 'font-weight: 300;',
600      maxWidth: 800,
601      font: 'TimesNewRoman',
602      font_size: '12pt',
603      honorMarginPadding: true,
604      honorColor: false,
605      properties: null,
606      gridHeaderStyle: 'font-weight: bold; padding: 5px; border: 1px solid #dddddd;',
607      gridStyle: 'border: 1px solid lightgray; margin-bottom: -1px;',
608      showModal: false,
609      onError: function onError(error) {
610        throw error;
611      },
612      onLoadingStart: null,
613      onLoadingEnd: null,
614      onPrintDialogClose: null,
615      onPdfOpen: null,
616      onBrowserIncompatible: function onBrowserIncompatible() {
617        return true;
618      },
619      modalMessage: 'Retrieving Document...',
620      frameId: 'printJS',
621      printableElement: null,
622      watermark:null,
623      documentTitle: 'Document',
624      targetStyle: ['clear', 'display', 'width', 'min-width', 'height', 'min-height', 'max-height'],
625      targetStyles: ['border', 'box', 'break', 'text-decoration'],
626      ignoreElements: [],
627      imageStyle: 'max-width: 100%;',
628      repeatTableHeader: true,
629      css: null,
630      style: null,
631      scanStyles: true,
632      base64: false
633
634      // Check if a printable document or object was supplied
635    };var args = arguments[0];
636    if (args === undefined) throw new Error('printJS expects at least 1 attribute.');
637
638    // Process parameters
639    switch (typeof args === 'undefined' ? 'undefined' : _typeof(args)) {
640      case 'string':
641        params.printable = encodeURI(args);
642        params.fallbackPrintable = params.printable;
643        params.type = arguments[1] || params.type;
644        break;
645      case 'object':
646        params.printable = args.printable;
647        params.base64 = typeof args.base64 !== 'undefined';
648        params.fallbackPrintable = typeof args.fallbackPrintable !== 'undefined' ? args.fallbackPrintable : params.printable;
649        params.fallbackPrintable = params.base64 ? 'data:application/pdf;base64,' + params.fallbackPrintable : params.fallbackPrintable;
650        for (var k in params) {
651          if (k === 'printable' || k === 'fallbackPrintable' || k === 'base64') continue;
652
653          params[k] = typeof args[k] !== 'undefined' ? args[k] : params[k];
654        }
655        break;
656      default:
657        throw new Error('Unexpected argument type! Expected "string" or "object", got ' + (typeof args === 'undefined' ? 'undefined' : _typeof(args)));
658    }
659
660    // Validate printable
661    if (!params.printable) throw new Error('Missing printable information.');
662
663    // Validate type
664    if (!params.type || typeof params.type !== 'string' || printTypes.indexOf(params.type.toLowerCase()) === -1) {
665      throw new Error('Invalid print type. Available types are: pdf, html, image and json.');
666    }
667
668    // Check if we are showing a feedback message to the user (useful for large files)
669    if (params.showModal) _modal2.default.show(params);
670
671    // Check for a print start hook function
672    if (params.onLoadingStart) params.onLoadingStart();
673
674    // To prevent duplication and issues, remove any used printFrame from the DOM
675    var usedFrame = document.getElementById(params.frameId);
676
677    if (usedFrame) usedFrame.parentNode.removeChild(usedFrame);
678
679    // Create a new iframe or embed element (IE prints blank pdf's if we use iframe)
680    var printFrame = void 0;
681
682    // Create iframe element
683    printFrame = document.createElement('iframe');
684
685    // Hide iframe
686    printFrame.setAttribute('style', 'visibility: hidden; height: 0; width: 0; position: absolute;');
687
688    // Set iframe element id
689    printFrame.setAttribute('id', params.frameId);
690
691    // For non pdf printing, pass an html document string to srcdoc (force onload callback)
692    if (params.type !== 'pdf') {
693      printFrame.srcdoc = '<html><head><title>' + params.documentTitle + '</title>';
694
695      // Attach css files
696      if (params.css !== null) {
697        // Add support for single file
698        if (!Array.isArray(params.css)) params.css = [params.css];
699
700        // Create link tags for each css file
701        params.css.forEach(function (file) {
702          printFrame.srcdoc += '<link rel="stylesheet" href="' + file + '">';
703        });
704      }
705
706      printFrame.srcdoc += '</head><body></body></html>';
707    }
708
709    // Check printable type
710    switch (params.type) {
711      case 'pdf':
712        // Check browser support for pdf and if not supported we will just open the pdf file instead
713        if (_browser2.default.isFirefox() || _browser2.default.isEdge() || _browser2.default.isIE()) {
714          try {
715            console.info('PrintJS currently doesn\'t support PDF printing in Firefox, Internet Explorer and Edge.');
716            if (params.onBrowserIncompatible() === true) {
717              var win = window.open(params.fallbackPrintable, '_blank');
718              win.focus();
719              if (params.onPdfOpen) params.onPdfOpen();
720            }
721          } catch (e) {
722            params.onError(e);
723          } finally {
724            // Make sure there is no loading modal opened
725            if (params.showModal) _modal2.default.close();
726            if (params.onLoadingEnd) params.onLoadingEnd();
727          }
728        } else {
729          _pdf2.default.print(params, printFrame);
730        }
731        break;
732      case 'image':
733        _image2.default.print(params, printFrame);
734        break;
735      case 'html':
736        _html2.default.print(params, printFrame);
737        break;
738      case 'raw-html':
739        _rawHtml2.default.print(params, printFrame);
740        break;
741      case 'json':
742        _json2.default.print(params, printFrame);
743        break;
744    }
745  }
746};
747
748/***/ }),
749
750/***/ "./src/js/json.js":
751/*!************************!*\
752  !*** ./src/js/json.js ***!
753  \************************/
754/*! no static exports found */
755/***/ (function(module, exports, __webpack_require__) {
756
757"use strict";
758
759
760Object.defineProperty(exports, "__esModule", {
761  value: true
762});
763
764var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
765
766var _functions = __webpack_require__(/*! ./functions */ "./src/js/functions.js");
767
768var _print = __webpack_require__(/*! ./print */ "./src/js/print.js");
769
770var _print2 = _interopRequireDefault(_print);
771
772function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
773
774exports.default = {
775  print: function print(params, printFrame) {
776    // Check if we received proper data
777    if (_typeof(params.printable) !== 'object') {
778      throw new Error('Invalid javascript data object (JSON).');
779    }
780
781    // Validate repeatTableHeader
782    if (typeof params.repeatTableHeader !== 'boolean') {
783      throw new Error('Invalid value for repeatTableHeader attribute (JSON).');
784    }
785
786    // Validate properties
787    if (!params.properties || !Array.isArray(params.properties)) {
788      throw new Error('Invalid properties array for your JSON data.');
789    }
790
791    // We will format the property objects to keep the JSON api compatible with older releases
792    params.properties = params.properties.map(function (property) {
793      return {
794        field: (typeof property === 'undefined' ? 'undefined' : _typeof(property)) === 'object' ? property.field : property,
795        displayName: (typeof property === 'undefined' ? 'undefined' : _typeof(property)) === 'object' ? property.displayName : property,
796        columnSize: (typeof property === 'undefined' ? 'undefined' : _typeof(property)) === 'object' && property.columnSize ? property.columnSize + ';' : 100 / params.properties.length + '%;'
797      };
798    });
799
800    // Create a print container element
801    params.printableElement = document.createElement('div');
802
803    // Check if we are adding a print header
804    if (params.header) {
805      (0, _functions.addHeader)(params.printableElement, params);
806    }
807
808    // Build the printable html data
809    params.printableElement.innerHTML += jsonToHTML(params);
810   
811    // Print the json data
812    _print2.default.send(params, printFrame);
813  }
814};
815
816
817function jsonToHTML(params) {
818  // Get the row and column data
819  var data = params.printable;
820  var properties = params.properties;
821
822  // Create a html table
823  var htmlData = '<table style="border-collapse: collapse; width: 100%;">';
824
825  // Check if the header should be repeated
826  if (params.repeatTableHeader) {
827    htmlData += '<thead>';
828  }
829
830  // Add the table header row
831  htmlData += '<tr>';
832
833  // Add the table header columns
834  for (var a = 0; a < properties.length; a++) {
835    htmlData += '<th style="width:' + properties[a].columnSize + ';' + params.gridHeaderStyle + '">' + (0, _functions.capitalizePrint)(properties[a].displayName) + '</th>';
836  }
837
838  // Add the closing tag for the table header row
839  htmlData += '</tr>';
840
841  // If the table header is marked as repeated, add the closing tag
842  if (params.repeatTableHeader) {
843    htmlData += '</thead>';
844  }
845
846  // Create the table body
847  htmlData += '<tbody>';
848
849  // Add the table data rows
850  for (var i = 0; i < data.length; i++) {
851    // Add the row starting tag
852    htmlData += '<tr>';
853
854    // Print selected properties only
855    for (var n = 0; n < properties.length; n++) {
856      var stringData = data[i];
857
858      // Support nested objects
859      var property = properties[n].field.split('.');
860      if (property.length > 1) {
861        for (var p = 0; p < property.length; p++) {
862          stringData = stringData[property[p]];
863        }
864      } else {
865        stringData = stringData[properties[n].field];
866      }
867
868      // Add the row contents and styles
869      htmlData += '<td style="width:' + properties[n].columnSize + params.gridStyle + '">' + stringData + '</td>';
870    }
871
872    // Add the row closing tag
873    htmlData += '</tr>';
874  }
875
876  // Add the table and body closing tags
877  htmlData += '</tbody></table>';
878
879  return htmlData;
880}
881
882/***/ }),
883
884/***/ "./src/js/modal.js":
885/*!*************************!*\
886  !*** ./src/js/modal.js ***!
887  \*************************/
888/*! no static exports found */
889/***/ (function(module, exports, __webpack_require__) {
890
891"use strict";
892
893
894Object.defineProperty(exports, "__esModule", {
895  value: true
896});
897var Modal = {
898  show: function show(params) {
899    // Build modal
900    var modalStyle = 'font-family:sans-serif; ' + 'display:table; ' + 'text-align:center; ' + 'font-weight:300; ' + 'font-size:30px; ' + 'left:0; top:0;' + 'position:fixed; ' + 'z-index: 9990;' + 'color: #0460B5; ' + 'width: 100%; ' + 'height: 100%; ' + 'background-color:rgba(255,255,255,.9);' + 'transition: opacity .3s ease;';
901
902    // Create wrapper
903    var printModal = document.createElement('div');
904    printModal.setAttribute('style', modalStyle);
905    printModal.setAttribute('id', 'printJS-Modal');
906
907    // Create content div
908    var contentDiv = document.createElement('div');
909    contentDiv.setAttribute('style', 'display:table-cell; vertical-align:middle; padding-bottom:100px;');
910
911    // Add close button (requires print.css)
912    var closeButton = document.createElement('div');
913    closeButton.setAttribute('class', 'printClose');
914    closeButton.setAttribute('id', 'printClose');
915    contentDiv.appendChild(closeButton);
916
917    // Add spinner (requires print.css)
918    var spinner = document.createElement('span');
919    spinner.setAttribute('class', 'printSpinner');
920    contentDiv.appendChild(spinner);
921
922    // Add message
923    var messageNode = document.createTextNode(params.modalMessage);
924    contentDiv.appendChild(messageNode);
925
926    // Add contentDiv to printModal
927    printModal.appendChild(contentDiv);
928
929    // Append print modal element to document body
930    document.getElementsByTagName('body')[0].appendChild(printModal);
931
932    // Add event listener to close button
933    document.getElementById('printClose').addEventListener('click', function () {
934      Modal.close();
935    });
936  },
937  close: function close() {
938    var printFrame = document.getElementById('printJS-Modal');
939
940    printFrame.parentNode.removeChild(printFrame);
941  }
942};
943
944exports.default = Modal;
945
946/***/ }),
947
948/***/ "./src/js/pdf.js":
949/*!***********************!*\
950  !*** ./src/js/pdf.js ***!
951  \***********************/
952/*! no static exports found */
953/***/ (function(module, exports, __webpack_require__) {
954
955"use strict";
956
957
958Object.defineProperty(exports, "__esModule", {
959  value: true
960});
961
962var _print = __webpack_require__(/*! ./print */ "./src/js/print.js");
963
964var _print2 = _interopRequireDefault(_print);
965
966var _functions = __webpack_require__(/*! ./functions */ "./src/js/functions.js");
967
968function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
969
970exports.default = {
971  print: function print(params, printFrame) {
972    // Check if we have base64 data
973    if (params.base64) {
974      var bytesArray = Uint8Array.from(atob(params.printable), function (c) {
975        return c.charCodeAt(0);
976      });
977      createBlobAndPrint(params, printFrame, bytesArray);
978      return;
979    }
980
981    // Format pdf url
982    params.printable = /^(blob|http)/i.test(params.printable) ? params.printable : window.location.origin + (params.printable.charAt(0) !== '/' ? '/' + params.printable : params.printable);
983
984    // Get the file through a http request (Preload)
985    var req = new window.XMLHttpRequest();
986    req.responseType = 'arraybuffer';
987
988    req.addEventListener('load', function () {
989      // Check for errors
990      if ([200, 201].indexOf(req.status) === -1) {
991        (0, _functions.cleanUp)(params);
992        params.onError(req.statusText);
993
994        // Since we don't have a pdf document available, we will stop the print job
995        return;
996      }
997
998      // Print requested document
999      createBlobAndPrint(params, printFrame, req.response);
1000    });
1001
1002    req.open('GET', params.printable, true);
1003    req.send();
1004  }
1005};
1006
1007
1008function createBlobAndPrint(params, printFrame, data) {
1009  // Pass response or base64 data to a blob and create a local object url
1010  var localPdf = new window.Blob([data], { type: 'application/pdf' });
1011  localPdf = window.URL.createObjectURL(localPdf);
1012
1013  // Set iframe src with pdf document url
1014  printFrame.setAttribute('src', localPdf);
1015
1016  _print2.default.send(params, printFrame);
1017}
1018
1019/***/ }),
1020
1021/***/ "./src/js/print.js":
1022/*!*************************!*\
1023  !*** ./src/js/print.js ***!
1024  \*************************/
1025/*! no static exports found */
1026/***/ (function(module, exports, __webpack_require__) {
1027
1028"use strict";
1029
1030
1031Object.defineProperty(exports, "__esModule", {
1032  value: true
1033});
1034
1035var _browser = __webpack_require__(/*! ./browser */ "./src/js/browser.js");
1036
1037var _browser2 = _interopRequireDefault(_browser);
1038
1039var _functions = __webpack_require__(/*! ./functions */ "./src/js/functions.js");
1040
1041function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1042
1043var Print = {
1044  send: function send(params, printFrame) {
1045    // Append iframe element to document body
1046    document.getElementsByTagName('body')[0].appendChild(printFrame);
1047
1048    // Get iframe element
1049    var iframeElement = document.getElementById(params.frameId);
1050    
1051    // Wait for iframe to load all content
1052    iframeElement.onload = function () {
1053      if (params.type === 'pdf') {
1054        performPrint(iframeElement, params);
1055        return;
1056      }
1057
1058      // Get iframe element document
1059      var printDocument = iframeElement.contentWindow || iframeElement.contentDocument;
1060      if (printDocument.document) printDocument = printDocument.document;
1061
1062      // Append printable element to the iframe body
1063      printDocument.body.appendChild(params.printableElement);
1064
1065      // Add custom style
1066      if (params.type !== 'pdf' && params.style) {
1067        // Create style element
1068        var style = document.createElement('style');
1069        style.innerHTML = params.style;
1070
1071        // Append style element to iframe's head
1072        printDocument.head.appendChild(style);
1073      }
1074
1075      // If printing images, wait for them to load inside the iframe
1076      var images = printDocument.getElementsByTagName('img');
1077
1078      if (images.length > 0) {
1079        loadIframeImages(images).then(function () {
1080          return performPrint(iframeElement, params);
1081        });
1082      } else {
1083        performPrint(iframeElement, params);
1084      }
1085    };
1086  }
1087};
1088
1089function performPrint(iframeElement, params) {
1090  try {
1091    iframeElement.focus();
1092
1093    // If Edge or IE, try catch with execCommand
1094    if (_browser2.default.isEdge() || _browser2.default.isIE()) {
1095      try {
1096        iframeElement.contentWindow.document.execCommand('print', false, null);
1097      } catch (e) {
1098        iframeElement.contentWindow.print();
1099      }
1100    } else {
1101      // Other browsers
1102      iframeElement.contentWindow.print();
1103    }
1104  } catch (error) {
1105    params.onError(error);
1106  } finally {
1107    (0, _functions.cleanUp)(params);
1108  }
1109}
1110
1111function loadIframeImages(images) {
1112  var promises = [];
1113
1114  var _iteratorNormalCompletion = true;
1115  var _didIteratorError = false;
1116  var _iteratorError = undefined;
1117
1118  try {
1119    for (var _iterator = images[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1120      var image = _step.value;
1121
1122      promises.push(loadIframeImage(image));
1123    }
1124  } catch (err) {
1125    _didIteratorError = true;
1126    _iteratorError = err;
1127  } finally {
1128    try {
1129      if (!_iteratorNormalCompletion && _iterator.return) {
1130        _iterator.return();
1131      }
1132    } finally {
1133      if (_didIteratorError) {
1134        throw _iteratorError;
1135      }
1136    }
1137  }
1138
1139  return Promise.all(promises);
1140}
1141
1142function loadIframeImage(image) {
1143  return new Promise(function (resolve) {
1144    var pollImage = function pollImage() {
1145      !image || typeof image.naturalWidth === 'undefined' || image.naturalWidth === 0 || !image.complete ? setTimeout(pollImage, 500) : resolve();
1146    };
1147    pollImage();
1148  });
1149}
1150
1151exports.default = Print;
1152
1153/***/ }),
1154
1155/***/ "./src/js/raw-html.js":
1156/*!****************************!*\
1157  !*** ./src/js/raw-html.js ***!
1158  \****************************/
1159/*! no static exports found */
1160/***/ (function(module, exports, __webpack_require__) {
1161
1162"use strict";
1163
1164
1165Object.defineProperty(exports, "__esModule", {
1166  value: true
1167});
1168
1169var _print = __webpack_require__(/*! ./print */ "./src/js/print.js");
1170
1171var _print2 = _interopRequireDefault(_print);
1172
1173function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1174
1175exports.default = {
1176  print: function print(params, printFrame) {
1177    // Create printable element (container)
1178    params.printableElement = document.createElement('div');
1179    params.printableElement.setAttribute('style', 'width:100%');
1180
1181    // Set our raw html as the printable element inner html content
1182    params.printableElement.innerHTML = params.printable;
1183
1184    // Print html contents
1185    _print2.default.send(params, printFrame);
1186  }
1187};
1188
1189/***/ }),
1190
1191/***/ "./src/sass/index.scss":
1192/*!*****************************!*\
1193  !*** ./src/sass/index.scss ***!
1194  \*****************************/
1195/*! no static exports found */
1196/***/ (function(module, exports, __webpack_require__) {
1197
1198// extracted by mini-css-extract-plugin
1199
1200/***/ })
1200,
1201
1202/***/ 0:
1203/*!****************************!*\
1204  !*** multi ./src/index.js ***!
1205  \****************************/
1206/*! no static exports found */
1207/***/ (function(module, exports, __webpack_require__) {
1208
1209module.exports = __webpack_require__(/*! ./src/index.js */"./src/index.js");
1210
1211
1212/***/ })
1213
1214/******/ })["default"];
1215});
1216//# sourceMappingURL=print.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.